[R] Hausman Test trouble - plm

2015-07-17 Thread TDix
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: 

  BirdSeason Gully Grouping   Food   Habitat.Type
1   83  111 0.152
2   47  111 0.091
3   47  111 1.343
4   47  111 0.091
5   51  113 0.152
6   51  113 0.152

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.

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Hausman Test trouble - plm

2015-07-17 Thread TDix
Might have just solved my own problem team!

I assumed that the issue here was the replicated samples, and so added a
column and gave a number to each replicate.

R seemed to like this and was happy to run the test!

A significant result tells me that the fixed effects model is the most
preferable model to explain the variation seen in my data.

Unless I am doing/assuming something wrong here that you can see then I
might well have solved my own problem.

Let me know if you have any thoughts :)

Cheers



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

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.