Matteo,

I fully agree with David: please read the posting guide.

Anyway, the error message says it all: "the estimated variance of the
individual effect is negative". See e.g. the "basic panel" chapter (10
or 11) in Wooldridge's "Econometric Analysis of XS and Panel Data" to
understand why this may happen.  

Stata's behaviour is (as far as I remember) to transparently substitute
it with 0; 'plm's is to let the estimation fail, issuing a warning. You
can try a different 'random.method' which may, or might not, solve the
problem, depending on your data. 

Hint: a random effects model with sigma_mu=0 is a pooling model.

HTH

Giovanni Millo, PhD
Research Dept.,
Assicurazioni Generali SpA
Via Machiavelli 3,
34132 Trieste (Italy)
tel. +39 040 671184
fax  +39 040 671160

------------ original message ------------------

Message: 49
Date: Thu, 3 Jan 2013 13:23:07 -0800
From: David Winsemius <dwinsem...@comcast.net>
To: matteo ognibene <ognibenemat...@hotmail.it>
Cc: "r-help@r-project.org" <r-help@r-project.org>
Subject: Re: [R] plm random effect: the estimated variance of the
        individual      effect is negative
Message-ID: <d32fdc11-38ae-4aaf-9270-30c791232...@comcast.net>
Content-Type: text/plain; charset=US-ASCII; format=flowed; delsp=yes


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



--------------- end original message ---------------

 
Ai sensi del D.Lgs. 196/2003 si precisa che le informazi...{{dropped:12}}

______________________________________________
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.

Reply via email to