Friday, 15 March 2013

Session 8 : Panel Data Analysis

Assignment 1:

Do the panel data analysis of "Produc" data in package "plm"

Solution:

Produc Data:


state  :  the state
year  :  the year
pcap :  private capital stock
hwy  :  highway and streets
water: water and sewer facilities
util    :  other public buildings and structures
pc    :   public capital
gsp  :   gross state products
emp :   labor input measured by the employement in non–agricultural payrolls
unemp : state unemployment rate

Commands:

> data("Produc",package="plm")
> head(Produc)

Pooled Effect Model:

> 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 Effects Model:

> 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 Effects Model:

> 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)



To determine which model is best:



Test 1 : Pooled vs Fixed:

Ho: Null Hypothesis: the individual index and time based params are all zero.

H1: Alternate Hypothesis: at least one of the index and time based params is non zero.

pFtest(fixed,pool)

        F test for individual effects

data:  log(pcap) ~ log(hwy) + log(water) + log(util) + log(pc) + log(gsp) +      log(emp) + log(unemp) 
F = 56.6361, df1 = 47, df2 = 761, p-value < 2.2e-16
alternative hypothesis: significant effects.

As p-value is too small, null hypothesis is rejected.  Therefore Fixed Effect Model is better than Pooled Model.



 Test 2 : Pooled vs Random:

Command:

>plmtest(pool)

  Lagrange Multiplier Test - (Honda)

data:  log(pcap) ~ log(hwy) + log(water) + log(util) + log(pc) + log(gsp) +      log(emp) + log(unemp) 
normal = 57.1686, p-value < 2.2e-16
alternative hypothesis: significant effects 

As p-value is too small, null hypothesis is rejected.  Therefore Random Effect Model is better than Pooled Model.



 Test 3 : Fixed vs Random:


Ho: Null Hypothesis: Individual effects are not correlated with any regressor. : Random Effect Model

H1: Alternate Hypothesis:  Individual effects are  correlated. : Fixed Effect Model

Command:

>phtest(random,fixed)

  Hausman Test

data:  log(pcap) ~ log(hwy) + log(water) + log(util) + log(pc) + log(gsp) +      log(emp) + log(unemp) 
chisq = 93.546, df = 7, p-value < 2.2e-16
alternative hypothesis: one model is inconsistent 

As p-value is too low, null Hypothesis is rejected. Therefore, Fixed Model is better than Random Model



So after making all the comparisons we come to the conclusion that Fixed Affect Model is best suited to do the panel data analysis for "Produc" data set.

Hence , we conclude that within the same id i.e. within same "state" there is no variation.




No comments:

Post a Comment