Hi,R 2.15.2 plm() function on Windows 7 when i perform a plm regression, i can't manage to obtain the intercept, but I need it.it gives me just the beta coefficient. my formula: fixed <- plm(deltaS ~ L1.deltaS + L2.deltaS, data=Mody_R, index=c("country_id", "date"), model="within") my output: Coefficients : Estimate Std. Error t-value Pr(>|t|) L1.deltaS -0.063576 0.017950 -3.5419 0.0004031 ***L2.deltaS -0.068272 0.017966 -3.8001 0.0001474 ***--- I tried adding "-0", "+1", "intercept=TRUE" Thanks,Matteo [[alternative HTML version deleted]]
Dear Matteo, a fixed effects (within) model does not have a single intercept: it has N. I suggest you have another look at FE models' theory. Some confusion often stems from Stata (misleadingly, IMHO) reporting an "intercept" which is actually the average of the individual intercepts, which you can recover in R as 'mean(fixef(<yourmodel>))'. Remember, though, that this isn't "the intercept" of the estimated model in the usual sense of the term. If you "need" an intercept, then you must review your specification. Best, Giovanni --------------- original message ------------------------------------------------------- Message: 1 Date: Sat, 29 Dec 2012 14:47:33 +0100 From: matteo ognibene <ognibenematteo at hotmail.it> To: <r-help at r-project.org> Subject: [R] I need intercept in plm model Message-ID: <DUB105-W4934C48C713500BA3FAF6CB63E0 at phx.gbl> Content-Type: text/plain Hi,R 2.15.2 plm() function on Windows 7 when i perform a plm regression, i can't manage to obtain the intercept, but I need it.it gives me just the beta coefficient. my formula: fixed <- plm(deltaS ~ L1.deltaS + L2.deltaS, data=Mody_R, index=c("country_id", "date"), model="within") my output: Coefficients : Estimate Std. Error t-value Pr(>|t|) L1.deltaS -0.063576 0.017950 -3.5419 0.0004031 ***L2.deltaS -0.068272 0.017966 -3.8001 0.0001474 ***--- I tried adding "-0", "+1", "intercept=TRUE" Thanks,Matteo [[alternative HTML version deleted]] ------------- end original message ----------------- ? Ai sensi del D.Lgs. 196/2003 si precisa che le informazi...{{dropped:12}}
matteo ognibene
2013-Jan-03 16:19 UTC
[R] plm random effect: the estimated variance of the individual effect is negative
Hi,R 2.15.2 plm() function on Windows 7 I have a problem with the variance estimation in a random effect model I used this formula to get my result, and it works:reg <- deltaF ~ L1.deltaF + L2.deltaF + deltaCDS + L1.deltaCDS + L2.deltaCDS + L3.deltaCDS + deltaUS_Yields + deltaZ + L1.deltaZ + L2.deltaZfixed <- plm(reg, data=Mody_R, na.action = na.exclude, index=c("country_id", "datestata"), model="random") but when i split my dataframe into several groups it gives me this error:"Error in swar(object, data, effect) : the estimated variance of the individual effect is negative" The code i used to split the dataframe is:SplitMody <- split(Mody_R, Mody_R$period)SplitFixed <- lapply(SplitMody, function(Mody_R) plm(reg, data=Mody_R, na.action = na.exclude, index=c("country_id", "datestata"), model="random")) I want to point the all the code works perfectly in a within model, and I tried using all the random.method for the variance estimation.In addition I used the same model in Stata and it works... (the results are identical for a within model in R and Stata) I'll be really gratefull if someone can help me. Thanks,Matteo [[alternative HTML version deleted]]