Dear Prof. Bolker, I am trying to find the best model to fit a set of data which are temporally correlated and which involve a factor response variable including three levels. I would like to test a GLMM and possibly compare it with a multinomial GEE. However, all the examples I found for GLMM using a factor as response variable are binomial and family options for the glmer function in R do not include multinomial. When I run it without specifying the family it automatically performs a LMM with a Gaussian distribution and besides not being sure it is a suitable option the output doesn?t show the levels of each explanatory factor variable. I found that the multinomial family is an option for the MCMCglmm function which also deals with temporal correlation, however when it comes to select the random effect I have a doubt and I am not sure I am understanding how to set it correctly. I have been reading the function help file in R and the paper ?GLMMs in action? however I have still doubts. The data I am using are temporally correlated at sequence level (i.e. all data are correlated within each sequence cluster) and I set this variable as random effect. Do all fixed variable need to be included at once in the random specification? It didn?t seem so in one example, so I was trying the following code. However, it failed giving the error ?unexpected input in model <- ?? guessing there is a syntax error but I have not been able to detect it. I include a subset of the data. trial <- read.csv(?swd.csv?, sep=?,? , header=T) trial$Dolphins.response=as.factor(trial$Dolphins.response) trial$Behaviour=as.factor(trial$Behaviour) trial$N.Sequence=as.factor(trial$N.Sequence) model <- MCMCglmm(Dolphins.response~Species + Boat.placement + Behaviour + Calves + Group.size + N.Swimmers , random=~idh(N.Swimmers):N.Sequence, data=trial, family=?multinomial?, verbose=FALSE) Any suggestion to get me on the right track is very much appreciated! Thank you very much! Best wishes, Arianna
MCMCglmm function
2 messages · Arianna Cecchetti, Ben Bolker
Just a quick reminder: while I (a) answer a lot of the posts here and
(b) spend a lot of time encouraging people to post here rather than
e-mailing me privately, this is *not* my e-mail: "Dear list" or "Dear
kind and generous mixed model gurus" (or something like that) would be a
better salutation ...
have you looked at the section on multinomial models (p. 95) in
vignette("CourseNotes",package="MCMCglmm") yet ... ?
good luck,
Ben Bolker
On 16-08-01 09:26 AM, Arianna Cecchetti wrote:
Dear Prof. Bolker, I am trying to find the best model to fit a set of data which are temporally correlated and which involve a factor response variable including three levels. I would like to test a GLMM and possibly compare it with a multinomial GEE. However, all the examples I found for GLMM using a factor as response variable are binomial and family options for the glmer function in R do not include multinomial. When I run it without specifying the family it automatically performs a LMM with a Gaussian distribution and besides not being sure it is a suitable option the output doesn?t show the levels of each explanatory factor variable. I found that the multinomial family is an option for the MCMCglmm function which also deals with temporal correlation, however when it comes to select the random effect I have a doubt and I am not sure I am understanding how to set it correctly. I have been reading the function help file in R and the paper ?GLMMs in action? however I have still doubts. The data I am using are temporally correlated at sequence level (i.e. all data are correlated within each sequence cluster) and I set this variable as random effect. Do all fixed variable need to be included at once in the random specification? It didn?t seem so in one example, so I was trying the following code. However, it failed giving the error ?unexpected input in model <- ?? guessing there is a syntax error but I have not been able to detect it. I include a subset of the data. trial <- read.csv(?swd.csv?, sep=?,? , header=T) trial$Dolphins.response=as.factor(trial$Dolphins.response) trial$Behaviour=as.factor(trial$Behaviour) trial$N.Sequence=as.factor(trial$N.Sequence) model <- MCMCglmm(Dolphins.response~Species + Boat.placement + Behaviour + Calves + Group.size + N.Swimmers , random=~idh(N.Swimmers):N.Sequence, data=trial, family=?multinomial?, verbose=FALSE) Any suggestion to get me on the right track is very much appreciated! Thank you very much! Best wishes, Arianna
_______________________________________________ R-sig-mixed-models at r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-sig-mixed-models