[R] Hausman Test trouble - plm

TDix flameboy111 at hotmail.com
Fri Jul 17 09:17:45 CEST 2015


Hi there.

I am a student / very fresh R user who is currently having some issues
running the procedure for a Hausman test in R.

The head for my data sheet named "data" looks like this: 

  Bird    Season Gully Grouping   Food   Habitat.Type
1   83      1        1        1         0.15            2
2   47      1        1        1         0.09            1
3   47      1        1        1         1.34            3
4   47      1        1        1         0.09            1
5   51      1        1        3         0.15            2
6   51      1        1        3         0.15            2

The code to run the test looks like this:

library(plm)

result=read.csv("H:/data",header=T,sep=",",stringsAsFactors=F)

wi=plm(Habitat.Type~Season+Gully+Grouping+Food, data = result, index
=c("Bird"),model="within")

re=plm(Habitat.Type~Season+Gully+Grouping+Food, data = result, index
=c("Bird"),model="random")

phtest(wi, re)


The reasoning behind this format is that Habitat.Type is the dependant
variable.
Season, Gully, Grouping and Food are the independant variables.
Bird (ID) is the index as it is the random effect.

The error message I am getting is this:

duplicate couples (time-id)
Error in pdim.default(index[[1]], index[[2]])

>From what I have been able to figure out this may be because I have multiple
identical observations. The problem is that I do not want to remove these
multiple identical observations, as that is a large part of my data.

My question to you - am I doing anything wrong? Is there a work around for
the duplicate error that I am getting without removing identical
observations?

Thanks so much for your help.




--
View this message in context: http://r.789695.n4.nabble.com/Hausman-Test-trouble-plm-tp4709990.html
Sent from the R help mailing list archive at Nabble.com.



More information about the R-help mailing list