効用最大化問題
下記の効用関数を3Dで表現してみる。 \[ u(x_{1},x_{2})=x_{1}^{\frac{1}{4}}x_{2}^{\frac{1}{4}} \] 今回は、インタラクティブな作図が可能なplotlyパッケージを用いる。
library(plotly)
packageVersion('plotly')
## [1] '4.7.1'
グリグリ動かせます!
x <- seq(0, 10, length= 30)
y <- x
f <- function(x, y) { x^(1/4)*y^(1/4)}
z <- outer(x, y, f)
plot_ly(z = z) %>% add_surface()
等高線で表してみる…
ここでは、無差別曲線(Indifference curve)
plot_ly(x = x, y = y, z = z, type = 'contour',
colorscale = 'heatmap',
autocontour = T,
contours = list(start = 0, end =3,size = 0.5, showlabels = TRUE))
本当に餃子とビールのみを提供している…
ミクロ経済学の事例としては申し分ない…