On 22-03-2012, at 11:48, priya.s...@zycus.com wrote: > Hi Berend > Thanks for your help. The model which l have mentioned shows that Pt is > dependent on Ft, EXt, FAIt, My objecttive is not only to find the impact of > these varibles on Pt but also to see the extent of effect of variables > influencing Ft, EXt, FAIt which are mentioned in respective equation 2,3,4 > on Pt. > So, l m still not clear how creation of matrix A will help with my objective .
But this formula gives you everything you need: y = solve(diag(4)-A) %*% z solve(diag(4)-A) is an inverse. z is a vector consisting of the exogenous parts of the equations and these can be written as B %*% <vector-of-exogenous-variables> So you'll get y = inverse of (I-A) %*% B %*% <exogenous-variables> Berend > Regards, > Priya Saha > . > > > > > > > > From: Berend Hasselman <b...@xs4all.nl> > To: priya.s...@zycus.com > Cc: R help <r-help@r-project.org> > Date: 22-03-2012 15:50 > Subject: Re: [R] Simalteneous Equation Doubt in R > > > > > > On 22-03-2012, at 09:15, priya.s...@zycus.com wrote: > > > Hi List > > > > l am interested in developing price model. I have found a research paper > > related to price model of corn in US market where it has taken demand & > > supply forces into consideration. Following are the equation: > > Supply equation: > > St= a0+a1Pt-1+a2Rt-1+a3St-1+a5D1+a6D2+a7D3+U1 -(1) > > Where D1,D2,D3=Quarterly Dummy Variables(Since quarterly data are > > considered) > > Here, Supply equation has 1 endogenous (St) & 6 exogenous variables (P > > t-1,Rt-1,St-1,D1,D2,D3) > > Demand Side: > > Demand of corn is divided into 3 equations: > > Feed equation: > > Ft=b0+b1Pt+b2P(sm)t+b3Bt+b4COFt+b5Ht+a6D1+a7D2+a8D3+U2 -(2) > > here there are 2 endogenous variable(Ft, Pt) & 7 exogenous variables > > (P(sm)t,Bt,COFt,D1,D2,D3) > > Export equation: > > EXt= c0+c1Pt+c2EXt-1+c3Wt+c4DXt+c5GDPt+c6D1+c7D2+c8D3+U3 -(3) > > here there are 2 endogenous variable(EXt, Pt) & 7 exogenous variables (EX > > t-1,Wt,DXt,D1,D2,D3) > > Food, Alcohol, Industry (FAI) Demand Equation: > > FAIt= d0+d1Pt+d2Etht+d3Popt+d4Tt+d5D1+d6D2+d7D3+U4 -(4) > > here there are 2 endogenous variable(FAIt, Pt) & 6 exogenous variable(Eth > > t,Popt,Tt,D1,D2,D3) > > Price Equation: price of corn is determined by supply and demand > > simultaneously, following is the reduced form equation: > > Pt=µ0+µ1St+µ2Ft+µ3EXt+µ4FAIt+µ5Pt-1+µ6D1+µ7D2+µ8D3+U5 -(5) > > here there are 5 endogenous variable(St, Ft,EXt, FAIt, Pt) & 4 exogenous > > variable(Pt-1,D1,D2,D3) > > Now my question is : > > By applying 3SLS in the price equation, it will show the impact of > > variables on Pt which are mentioned in equation (5).But if l want to find > > impact of ETHt from equation (4) on Pt , l'll have to substitute equation > > (1),(2),(3),(4) in price equation(5), which manually becomes very tedious, > > is there any way this could be done directly in R? > > Your system can be written compactly as > > St = + zS > Ft = b1Pt + zF > EXt = c1Pt + zEX > FAIt= d1Pt + zFAI > Pt = µ2Ft+µ3EXt+µ4FAIt + zP > > St is exogenous so can be ignored. > The system is linear and can be written as where the zXXX are the exogenous > terms of the equation for XXX. > > ( Ft ) ( 0 0 0 b1 ) ( Ft ) ( zF ) > ( EXt ) = ( 0 0 0 c1 ) ( EXt ) + ( zEX ) > ( FAIt ) ( 0 0 0 d1 ) ( FAIt ) ( zFAI ) > ( Pt ) ( µ2 µ3 µ4 0 ) ( Pt ) ( zP ) > > (Note: read the stacked ( and ) as a single large ( or )) > or > > y = A %*% y + z > > which can be written as > > y = solve(diag(4)-A) %*% z > > You only need to construct the matrix A. > > Berend > > > > ______________________________________________ R-help@r-project.org 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.