[R] plm random effect: the estimated variance of the individual effect is negative
matteo ognibene
ognibenematteo at hotmail.it
Fri Jan 4 13:10:22 CET 2013
You're right David, I'm really sorry. I deactivated html, hope now it works.
> 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.
> fixed <- 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 random effect model in Stata and it works... (and for the within model the results are identical in R and Stata)
I'll be really gratefull if someone can help me.
Thanks,
Matteo
> CC: r-help at r-project.org
> From: dwinsemius at comcast.net
> To: ognibenematteo at hotmail.it
> Subject: Re: [R] plm random effect: the estimated variance of the individual effect is negative
> Date: Thu, 3 Jan 2013 13:23:07 -0800
>
>
> On Jan 3, 2013, at 8:19 AM, matteo ognibene wrote:
>
> >
> > 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]]
>
> Head up; matteo: This is pretty much unreadable (due to the failure to
> follow the recommended posting procedure.)
>
> --
> David Winsemius, MD
> Alameda, CA, USA
>
More information about the R-help
mailing list