Indifference curve

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Indifference curve

Akhil dua
Hello everyone I am new to R

I need to plot 3 indifference curve for the level 100, 200 and 300

my utility function is of the form u(x,y)=3x^2+2y

I also need to draw contour line on it

can any one please tell me how to do it????

        [[alternative HTML version deleted]]

______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.
Reply | Threaded
Open this post in threaded view
|

Re: Indifference curve

Rui Barradas
Hello,

Is this it?


u <- function(x, y) 3*x^2 + 2*y

x <- seq(-10, 10, by=1)
y <- seq(0, 150, by=1)
a <- c(100, 200, 300)

persp(x, y, outer(x, y, u), ticktype="detailed")
contour(x, y, outer(x, y, u), levels=a)

Hope this helps,

Rui Barradas

Em 28-06-2012 10:13, Akhil dua escreveu:

> Hello everyone I am new to R
>
> I need to plot 3 indifference curve for the level 100, 200 and 300
>
> my utility function is of the form u(x,y)=3x^2+2y
>
> I also need to draw contour line on it
>
> can any one please tell me how to do it????
>
> [[alternative HTML version deleted]]
>
> ______________________________________________
> [hidden email] mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>

______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.