View source: R/tool_ranfixef.R
ranef.plm  R Documentation 
Function to calculate the random effects from a plm
object
(random effects model).
## S3 method for class 'plm' ranef(object, effect = NULL, ...)
object 
an object of class 
effect 

... 
further arguments (currently not used). 
Function ranef
calculates the random effects of a fitted random
effects model. For oneway models, the effects of the estimated
model are extracted (either individual or time effects). For
twoway models, extracting the individual effects is the default
(both, argument effect = NULL
and effect = "individual"
will
give individual effects). Time effects can be extracted by setting
effect = "time"
.
Not all random effect model types are supported (yet?).
A named numeric with the random effects per dimension (individual or time).
Kevin Tappe
fixef()
to extract the fixed effects from a fixed
effects model (within model).
data("Grunfeld", package = "plm") m1 < plm(inv ~ value + capital, data = Grunfeld, model = "random") ranef(m1) # individual random effects # compare to random effects by ML estimation via lme from package nlme library(nlme) m2 < lme(inv ~ value + capital, random = ~1firm, data = Grunfeld) cbind("plm" = ranef(m1), "lme" = unname(ranef(m2))) # twoways RE model, calculate individual and time random effects data("Cigar", package = "plm") tw < plm(sales ~ pop + price, data = Cigar, model = "random", effect = "twoways") ranef(tw) # individual random effects ranef(tw, effect = "time") # time random effects
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.