Also to choose the best model by using the tests:
pFtest : between fixed and pooled
plmtest: between pooled and random
phtest : between random and fixed
To load the data
Commands:
> data("Produc" , package ="plm")
> head(Produc)

Pooled Affects Model
Commands:
> pool <- plm(log(pcap)~ log(hwy) + log(water) + log(util) + log(pc) + log(gsp) + log(emp) + log(unemp) , data =Produc, model=("pooling"), index = c("state","year"))
> summary(pool)

Fixed Affects Model
Commands:
> fixed <- plm(log(pcap)~ log(hwy) + log(water) + log(util) + log(pc) + log(gsp) + log(emp) + log(unemp) , data =Produc, model=("within"), index = c("state","year"))
> summary(fixed)

Random Affects Model
Commands:
> random <- plm(log(pcap)~ log(hwy) + log(water) + log(util) + log(pc) + log(gsp) + log(emp) + log(unemp) , data =Produc, model=("random"), index = c("state","year"))
> summary(random)

Tests:
Pooled vs Fixed:
H0: Pooled Affects Model
H1: Fixed Affects Model

As the p-value is very small, we reject the null hypothesis and accept the alternate hypothesis.
=> Fixed affects model is accepted.
Pooled vs Random:
H0: Pooled Affects Model
H1: Random Affects Model

As the p-value is very small, we reject the null hypothesis and accept the alternate hypothesis.
=> Fixed affects model is accepted.
Result:
By conducting all the above tests, we come to a conclusion that Fixed Affects Model is the best to do the panel data analysis for "Produc".
No comments:
Post a Comment