In this notebook I simulate a linear monocentric city model with Cobb-Douglas preferences and Cobb-Douglas housing production.

Specifications Utility: \(U(q,z)=q^{\beta}z^{1-\beta}\)

Housing Production: \(H=K^{1-\alpha}L^{\alpha}\)

Homework Exercise Parameters:

\(\beta=0.5\), \(w=100\), \(\tau=20\), \(i=0.1\), \(\alpha=0.75\), \(r.A=100\), \(N=1000\)

options(scipen=1, digits=4)
beta=0.5
w=100
tau=20
i=0.1
alpha=0.75
r.A=100
N=1000
U<-function(q,z,beta){
  q^b*z^(1-b)
}
H<-function(K,L,alpha){
  K^(1-alpha)*L^alpha
}
h<-function(S,alpha){
  S^(1-alpha)
}
#Marshallian demand for housing (q)
q.m<-function(x,p,beta,w,tau) {
  beta*(w-tau*x)/p
}
#Marshallian demand for numeraire (z)
z.m<-function(x,beta,w,tau) {
 (1-beta)*(w-tau*x)
}
#Density at x
D.x<-function(x,p,r,S,beta,w,tau) {
  h(S,alpha)/q.m(x,p,beta,w,tau)
}
#Indirect utility at location x
V<-function(x,p,w,tau,beta){
  q.star<-(beta*(w-tau*x))/p
  z.star<-(w-tau*x)*(1-beta)
  (q.star^beta)*(z.star^(1-beta))
}
#price as function of indirect utility
P.v<-function(x,v,beta,w,tau) {
  beta*(1-beta)^((1-beta)/beta)*((w-tau*x)/v)^(1/beta)
}
#Optimal capital to land ratio (from FOC's)
S.eq<-function(r,alpha,i){
  ((1-alpha)*r)/(alpha*i)
}
#Cost assuming zero profit
C.zp<-function(S,r,h,i){
  (i*S+r)/h
}
R.x<-function(x,p,i,alpha) {
  p^(1/alpha)*i^((alpha-1)/alpha)*(1-alpha)^((1-alpha)/alpha)*alpha
}

Solving for equilibrium We know that \(r(0)=r_A+\tau*N\)

#First find values at center
r.zero<-r.A+tau*N
S.zero<-S.eq(r.zero,alpha,i)
h.zero<-h(S.zero,alpha)
c.zero<-C.zp(S.zero,r.zero,h.zero,i)
p.zero<-c.zero
u.eq<-V(0,p.zero,w,tau,beta)
P.v(0,u.eq,beta,w,tau)-p.zero #test
## [1] 2.274e-13
#Now values at fringe
S.xbar<-S.eq(r.A,alpha,i)
h.xbar<-h(S.xbar,alpha)
c.xbar<-C.zp(S.xbar,r.A,h.xbar,i)
#Now use price function to find xbar
fun<-function(x) {
  P.v(x,u.eq,beta,w,tau)-c.xbar
}
#Limit of xbar is w/tau; if xbar>w/tau consumer has negative income after commuting
x.bar<-as.numeric(uniroot(fun,lower=0,upper=w/tau)[1])
D.zero<-D.x(0,p.zero,r.zero,S.zero,beta,w,tau)
D.xbar<-D.x(x.bar,P.v(x.bar,u.eq,beta,w,tau),r.A,S.xbar,beta,w,tau)
Variable Equilibrium Value
Utility \(\bar{u}=\) 1.2251
Distance to fringe \(\bar{x}=\) 4.3156
Land rent at center \(R(0)=\) 20100
Housing price at center \(P(0)=\) 1665.7741
Density at center \(D(0)=\) 536
Density at fringe \(D(\bar{x})=\) 19.4841

Show that utility is same everywhere

curve(V(x,P.v(x,u.eq,beta,w,tau),w,tau,beta),from=0,to=x.bar) #check that utility is same everywhere