The sample code providing in the text is the following:

library(plm)

data("Grunfeld", package = "plm")

reAR1ML <- lme(inv ~ value + capital, data = Grunfeld,

random = ~ 1 | firm, correlation = corAR1(0, form = ~ year | firm))

Here is my attempt at trying to describe the model this code is fitting:

Yit = Xitꞵ + μit

μit = δ + it

it = ρit-1 + ϵit

Where Yit is the gross investment of the ith firm in year t, Xit is a row vector of the independent variables variables (value and capita) , and muit is a random error term, uncorrelated with Xit, which captures variation around the mean.

The second equation which decomposes μit includes an unobserved heterogeneity component, δ, which varies across firms but is constant across time. It reflects unobserved characteristics of firms which render a given firm’s investment less or more than what would be predicted from Xitꞵ. vit contains the autoregressive component, which is further decomposed in equation (3).

The AR(1) component in equation(3) allows the firm’s investment to vary systematically by year around the firm’s own mean, according to that firm’s previous year’s investment (it-1) and the error term.