plm does not have a predict function, so forget my former mail. To get
to the coefficients, you just :
coef(mdl)
The rest of the calculations you can figure out I guess.
I'm also not sure if you're doing what you think you're doing. You
never specified the index stno in your pml call. Read the help files
again. And while you're at it, read the posting guide for the list as
well:
http://www.R-project.org/posting-guide.html
Cheers
Joris
On Wed, Jun 9, 2010 at 11:54 AM, mike mick <saint-filth at hotmail.com>
wrote:>
>
>
>
>
>
>
>
> From: saint-filth at hotmail.com
> To: saint-filth at hotmail.com
> Subject: RE:
> Date: Wed, 9 Jun 2010 09:53:20 +0000
>
>
>
>
>
>
>
>
>
> OK! sorry thats my fault,
>
> here the translations of the stata commands
> 1st step is to get the mean values of the variables, well that doesnt need
explanation i guess,
>
> 2nd step is to estimate the model on panel data estimation method
> which is:
>
mdl<-plm(lnLP~lnC+lnL+lnM+lnE+Eco+Inno+Eco*Inno+Eco*lnM+Eco*lnE+year,data=newdata,model="within")
> and basically i need to get the marginal effect of variable "Eco"
at the sample mean (step 3) but i am not that good in R so any additional help
is wlcome!
> Thanks
> From: saint-filth at hotmail.com
> To: r-help at r-project.org
> Subject:
> Date: Wed, 9 Jun 2010 09:45:16 +0000
>
>
>
>
>
>
>
> It helps if you translate the Stata commands. Not everybody is fluent
> in those. It would even help more if you would enlight us about the
> function you used to fit the model. Getting the marginal effects is
> not that hard at all, but how depends a bit on the function you used
> to estimate the model.
>
> You can try
>
predict(your_model,type="terms",terms="the_term_you're_interested_in")
>
> For exact information, look at the respective predict function, eg if
> you use lme, do ?predict.lme
> Be aware of the fact that R normally choses the correct predict
> function without you having to specify it. predict() works for most
> model objects. Yet, depending on the model eacht predict function can
> have different options or different functionality. That information is
> in the help files of the specific function.
>
> Cheers
> Joris
>
> Dear all,
>
> I need to use R for one estimation, and i have readily available ?stata
command, but i need also the R version of the same command.
> the estimation in stata is as following:
> ? 1. Compute mean values of relevant variables
>
>
>
> . sum inno lnE lnM
>
>
>
> ? ?Variable | ? ? ? Obs ? ? ? ?Mean ? ?Std. Dev. ? ? ? Min ? ? ? ?Max
>
> -------------+--------------------------------------------------------
>
> ? ? ? ?inno | ? ?146574 ? ?.0880374 ? ?.2833503 ? ? ? ? ?0 ? ? ? ? ?1
>
> ? ? ? ? lnE | ? ?146353 ? ?.9256239 ? ?1.732912 ?-4.473922 ? 10.51298
>
> ? ? ? ? lnM | ? ?146209 ? ?4.281903 ? ?1.862192 ?-4.847253 ? 13.71969
>
>
>
> ? ? ? ?2. Estimate model
>
>
>
> . xi: xtreg lnLP lnC lnL lnE lnM eco inno eco_inno eco_lnE eco_lnM i.year,
fe i(stno)
>
> i.year ? ? ? ? ? ?_Iyear_1997-1999 ? ?(naturally coded; _Iyear_1997
omitted)
>
>
>
> Fixed-effects (within) regression ? ? ? ? ? ? ? Number of obs ? ? ?= ?
?146167
>
> Group variable (i): stno ? ? ? ? ? ? ? ? ? ? ? ?Number of groups ? = ? ?
48855
>
>
>
> R-sq: ?within ?= 0.9908 ? ? ? ? ? ? ? ? ? ? ? ? Obs per group: min = ? ? ?
? 1
>
> ? ? ? between = 0.9122 ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?avg = ? ? ?
3.0
>
> ? ? ? overall = 0.9635 ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?max = ? ? ? ?
3
>
>
>
> ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?F(11,97301) ? ? ? ?=
949024.29
>
> corr(u_i, Xb) ?= 0.2166 ? ? ? ? ? ? ? ? ? ? ? ? Prob > F ? ? ? ? ? = ?
?0.0000
>
>
>
>
------------------------------------------------------------------------------
>
> ? ? ? ?lnLP | ? ? ?Coef. ? Std. Err. ? ? ?t ? ?P>|t| ? ? [95% Conf.
Interval]
>
>
-------------+----------------------------------------------------------------
>
> ? ? ? ? lnC | ? .0304896 ? .0009509 ? ?32.06 ? 0.000 ? ? .0286258 ?
?.0323533
>
> ? ? ? ? lnL | ?-.9835998 ? .0006899 -1425.74 ? 0.000 ? ? -.984952 ?
-.9822476
>
> ? ? ? ? lnE | ? .0652658 ? .0009439 ? ?69.14 ? 0.000 ? ? .0634158 ?
?.0671159
>
> ? ? ? ? lnM | ? .6729931 ? .0012158 ? 553.53 ? 0.000 ? ? ? .67061 ?
?.6753761
>
> ? ? ? ? eco | ? .0610348 ? .0177048 ? ? 3.45 ? 0.001 ? ? .0263336 ? ?
.095736
>
> ? ? ? ?inno | ? .0173824 ? .0058224 ? ? 2.99 ? 0.003 ? ? .0059706 ?
?.0287943
>
> ? ?eco_inno | ? .0080325 ? .0110815 ? ? 0.72 ? 0.469 ? ?-.0136872 ?
?.0297522
>
> ? ? eco_lnE | ? .0276226 ? ?.004059 ? ? 6.81 ? 0.000 ? ? ?.019667 ?
?.0355781
>
> ? ? eco_lnM | ?-.0214237 ? .0039927 ? ?-5.37 ? 0.000 ? ?-.0292494 ?
-.0135981
>
> ?_Iyear_1998 | ?-.0317684 ? .0013978 ? -22.73 ? 0.000 ? ? -.034508 ?
-.0290287
>
> ?_Iyear_1999 | ?-.0647261 ? .0027674 ? -23.39 ? 0.000 ? ?-.0701501 ?
-.0593021
>
> ? ? ? _cons | ? 1.802112 ? ?.009304 ? 193.69 ? 0.000 ? ? 1.783876 ?
?1.820348
>
>
-------------+----------------------------------------------------------------
>
> ? ? sigma_u | ?.38142386
>
> ? ? sigma_e | ? .2173114
>
> ? ? ? ? rho | ?.75494455 ? (fraction of variance due to u_i)
>
>
------------------------------------------------------------------------------
>
> F test that all u_i=0: ? ? F(48854, 97301) = ? ? 3.30 ? ? ? ?Prob > F =
0.0000
>
>
>
> ? ? ? ?3. Compute marginal effect of eco at sample mean
>
>
>
> . nlcom
(_b[eco]+_b[inno]*.0880374+_b[eco_lnE]*.9256239+_b[eco_lnM]*4.281903)
>
>
>
> ? ? ? _nl_1:
?_b[eco]+_b[inno]*.0880374+_b[eco_lnE]*.9256239+_b[eco_lnM]*4.281903
>
>
>
>
------------------------------------------------------------------------------
>
> ? ? ? ?lnLP | ? ? ?Coef. ? Std. Err. ? ? ?t ? ?P>|t| ? ? [95% Conf.
Interval]
>
>
-------------+----------------------------------------------------------------
>
> ? ? ? _nl_1 | ?-.0036011 ? ?.008167 ? ?-0.44 ? 0.659 ? ?-.0196084 ?
?.0124061
>
>
------------------------------------------------------------------------------
>
>
>
> in fact i can find the mean of the variables ( step 1) and extimate the
model (step 2) but i couldnt find the equivalent of step 3 (compute marginal
effect of eco at sample mean). Can someone help me for this issue?
>
> Cheers!
> Windows 7: Size en uygun bilgisayar? bulun. Daha fazla bilgi edinin.
> _________________________________________________________________
> Yeni Windows 7: Size en uygun bilgisayar? bulun. Daha fazla bilgi edinin.
> http://windows.microsoft.com/shop
> ? ? ? ?[[alternative HTML version deleted]]
>
>
> ______________________________________________
> R-help at 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.
>
>
--
Joris Meys
Statistical consultant
Ghent University
Faculty of Bioscience Engineering
Department of Applied mathematics, biometrics and process control
tel : +32 9 264 59 87
Joris.Meys at Ugent.be
-------------------------------
Disclaimer : http://helpdesk.ugent.be/e-maildisclaimer.php