Friday, 15 March 2013

IT lab session 8

Assignment 8 : Panel Data Analysis

We will be doing Panel Data Analysis of "Produc" data

We will be analyzing on three types of model :
      Pooled affect model
      Fixed affect model
      Random affect model

Commands:

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


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



Comparison
 
The comparison between the models would be a Hypothesis testing based on the following concept:
 
H0: Null Hypothesis: the individual index and time based params are all zero
H1: Alternate Hypothesis: atleast one of the index and time based params is non zero
 
Pooled vs Fixed
 
Null Hypothesis: Pooled Affect Model
Alternate Hypothesis : Fixed Affect Model
 
Command:
> pFtest(fixed,pool)
Result:
Since the p value is negligible so we reject the Null Hypothesis and hence Alternate hypothesis is accepted which is to accept Fixed Affect Model.


Pooled vs Random
 
Null Hypothesis: Pooled Affect Model
Alternate Hypothesis: Random Affect Model
 
Command :
> plmtest(pool)
 
Result:
 
Since the p value is negligible so we reject the Null Hypothesis and hence Alternate hypothesis is accepted which is to accept Random Affect Model.


Random vs Fixed
 
Null Hypothesis: No Correlation . Random Affect Model
Alternate Hypothesis: Fixed Affect Model
 
Command:
 > phtest(fixed,random)
 
Result:
 
Since the p value is negligible so we reject the Null Hypothesis and hence Alternate hypothesis is accepted which is to accept Fixed Affect Model.

Conclusion: 
 
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