Friday, 15 March 2013

IT and Business Applications Lab - Day7 Assignments



Panel Data Analysis  -  "Produc" data

Here we analyze three types of model :
  • Pooled effect model
  • Fixed effect model
  • Random effect model 

Then we will determine the best model by using functions:

  • pFtest : for determining between fixed and pooled
  • plmtest : for determining between pooled and random
  • phtest: for determining between random and fixed


Code :

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



Data

Pooled Effect Model

> pool <- br="" data="Produc," emp="" gsp="" hwy="" index="c(" log="" model="(" pc="" pcap="" plm="" pooling="" state="" unemp="" util="" water="" year=""> > summary(pool)




Fixed Effect Model:


> fixed <- data="Produc," emp="" gsp="" hwy="" index="c(" log="" model="(" pc="" pcap="" plm="" span="" state="" unemp="" util="" water="" within="" year="">
> summary(fixed)



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




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


H0: Pooled Effect Model
H1 : Fixed Effect Model


Code:
> pFtest(fixed,pool)


Result:


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
Since the p value is negligible so we reject the Null Hypothesis and hence Alternate hypothesis is accepted which is to accept Fixed Effect Model.





Random vs Fixed


Null Hypothesis: No Correlation . Random Effect Model
Alternate Hypothesis: Fixed Effect Model


Command:
> phtest(fixed,random)


Result:


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


Since the p value is negligible so we reject the Null Hypothesis and hence Alternate hypothesis is accepted which is to accept Fixed Effect Model.





Inference:

We infer that Fixed effect 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 difference.







No comments:

Post a Comment