Skip to content

Instantly share code, notes, and snippets.

@jonnyrobbie
Last active March 18, 2017 15:00
Show Gist options
  • Select an option

  • Save jonnyrobbie/db22cdab7af6f0e0b94887970f22da4d to your computer and use it in GitHub Desktop.

Select an option

Save jonnyrobbie/db22cdab7af6f0e0b94887970f22da4d to your computer and use it in GitHub Desktop.
require("plm")
require("nlme")
data(Grunfeld)
pooled.plm <- plm(inv~value+capital, data=Grunfeld, model="pooling")
summary(pooled.plm) #Gujarati 16.3.1
fixed.firm.plm <- plm(inv~value+capital, data=Grunfeld, model="within",
index=c("firm", "year"), effect="individual")
summary(fixed.firm.plm) #Gujarati 16.3.4
fixef(fixed.firm.plm) #Gujarati 16.3.4
fixed.year.plm <- plm(inv~value+capital, data=Grunfeld, model="within",
index=c("firm", "year"), effect="time")
summary(fixed.year.plm) #Gujarati 16.3.6
fixef(fixed.year.plm) #Gujarati 16.3.6
random.plm <- plm(inv~value+capital, data=Grunfeld, model="random",
index=c("firm", "year"), effect="individual")
summary(random.plm)
# {plm} nema funkce na extrakci individualnich random effecktu. Misto toho
# pouziju package {nlme}
random.nlme <- lme(inv~value+capital, random=~1|firm, data=Grunfeld)
summary(random.nlme) #Gujarati Table 16.3
random.effects.nlme <- ranef(random.nlme)
random.effects.nlme #Gujarati Table 16.3
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment