'Access theta from random effect model in plm()

I am running a random effects model and would like to take the theta object (the quasi-demeaned variance) and store it to an object. Looking around, it is not clear what this is stored as in a plm() object or where it comes from when I run the summary() function.

Here’s an example of code:

library(plm)
data("Produc", package = "plm")
zz <- plm(log(gsp) ~ log(pcap) + log(pc) + log(emp) + unemp, 
    data = Produc, index = c("state", "year"),
    model = "random")

summary(zz)
...
Effects:
                   var  std.dev share
idiosyncratic 0.001454 0.038137 0.175
individual    0.006838 0.082691 0.825
theta: 0.8888
...

I thought I might access it by doing theta <- zz$theta but that returns NULL.

Anyone more familiar with how this package works who could give advice would be much appreciated!



Solution 1:[1]

The ercomp element of the model object contains the estimation of various component errors. You perhaps mean to get theta from zz$ercomp$theta; however, you do not have a random effects model in your original post?

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 langtang