[R] Double Hierarchical Generalized Linear Models
Mariana Velasque
marianavelasque at gmail.com
Wed May 27 19:00:18 CEST 2015
I am new modeling and I am trying to analyse my data using the package Double Hierarchical Generalized Linear Models. However, I always get the same sort of error:
Error in z %*% v_h : non-conformable arguments.
I think that this error indicates that the matrices are created with non-calculable dimensions, but I don't know how to solve it.
I am creating my model with two fixed and two random effects. with this format:
rm(list=ls(all=TRUE))
library("dhglm")
data=read.csv("log_data.csv", header=TRUE)
phi<-matrix(1,n<-nrow(data),1)
lambda<-matrix(1,n<-nrow(data),1)
data<-cbind(data,phi,lambda)
sr <- as.numeric(data$SR) ##Dependent variable
id <- as.numeric(data$ID) ##individual number
obs <- as.numeric(data$Obs) ##Observation number
o2r <- as.numeric(data$O2R) ##Fixed factor 1 (oxygen consumption 1)
o2a <-as.numeric(data$O2A) ##Fixed factor 2 (oxygen consumption 2)
lambda <-as.numeric(data$lambda)
phi<-as.numeric(data$phi)
model_mu<-DHGLMMODELING(Model="mean",
Link="log",
LinPred= sr~o2a+ o2r + (1|id) + (1|obs),
RandDist= c("inverse-gamma", "gamma"),
LinPredRandVariance=lambda~ 1 +(1|id) + (1|obs) ,
RandDistRandVariance=c("gaussian", "gaussian"))
model_phi<-DHGLMMODELING(Model="dispersion",
Link="log",
LinPred = phi~o2a+ o2r + (1|id) + (1|obs),
RandDist= c("gaussian", "gaussian"))
res_glm<-dhglmfit(RespDist="gaussian",
DataMain=data,
MeanModel=model_mu,
DispersionModel=model_phi,
PhiFix=NULL, LamFix=NULL,mord=1,dord=1,Maxiter=200,convergence=1e-06)
Mariana Velasque
PhD Student
Marine Biology & Ecology Research Centre | School of Marine Science and Engineering | Plymouth University | 616 Davy | Drakes Circus | Plymouth | PL4 8AA | UK | +44 1752 5 84598 (Shared phone) | mariana.velasqueborges at plymouth.ac.uk <https://webmail.plymouth.ac.uk/owa/redir.aspx?C=0UUp9Pz8dkK1n_4m1deYkaEPZLevftEIjV4BgdiwFBa9Smiq3Nzoxl6fFxk5PwzRXWIRYoEPm8k.&URL=mailto%3amariana.velasqueborges%40plymouth.ac.uk> | marianavelasque at gmail.com <https://webmail.plymouth.ac.uk/owa/redir.aspx?C=0UUp9Pz8dkK1n_4m1deYkaEPZLevftEIjV4BgdiwFBa9Smiq3Nzoxl6fFxk5PwzRXWIRYoEPm8k.&URL=mailto%3amarianavelasque%40gmail.com>
Doutoranda
Centro de Pesquisa em Biologia Marinha & Ecologia | Faculdade de Ciências e Engenharia Marinha | Universidade de Plymouth | 616 Davy | Drakes Circus | Plymouth | PL4 8AA | UK | +44 1752 5 84598 (Telefone compartilhado) |mariana.velasqueborges at plymouth.ac.uk <https://webmail.plymouth.ac.uk/owa/redir.aspx?C=0UUp9Pz8dkK1n_4m1deYkaEPZLevftEIjV4BgdiwFBa9Smiq3Nzoxl6fFxk5PwzRXWIRYoEPm8k.&URL=mailto%3a%7cmariana.velasqueborges%40plymouth.ac.uk> |marianavelasque at gmail.com <https://webmail.plymouth.ac.uk/owa/redir.aspx?C=0UUp9Pz8dkK1n_4m1deYkaEPZLevftEIjV4BgdiwFBa9Smiq3Nzoxl6fFxk5PwzRXWIRYoEPm8k.&URL=mailto%3amarianavelasque%40gmail.com>
[[alternative HTML version deleted]]
More information about the R-help
mailing list