[R] Double Hierarchical Generalized Linear Models
dwinsemius at comcast.net
Thu May 28 02:26:14 CEST 2015
On May 27, 2015, at 10:00 AM, Mariana Velasque wrote:
> 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.
It means the either one or more of those are not matrices or that dim(z) is not equal to dim(v_h)
Cannot multiply matrix and array
> matrix(1:4, 2) %*% array(1:8, c(2,2,2))
Error in matrix(1:4, 2) %*% array(1:8, c(2, 2, 2)) :
> matrix(1:4, 2) %*% matrix(1:8, 2)
[,1] [,2] [,3] [,4]
[1,] 7 15 23 31
[2,] 10 22 34 46
> dim(matrix(1:4, 2)) == dim( matrix(1:8, 2))
> matrix(1:4, 2) %*% matrix(1:8, 4)
Error in matrix(1:4, 2) %*% matrix(1:8, 4) : non-conformable arguments
Suggests to me that you are sending the function a data layout that it was not designed to handle.
> 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))
Many people think it is rather discourteous to leave this code in without a comment symbol in front of it as a warning.
> data=read.csv("log_data.csv", header=TRUE)
Since we cannot see these 'data', none of the rest of the code will be meaningful other than letting us see that none of your objects had those names. (But perhaps one of your columns was named "z" or "v_h"? The error is apparently not being trapped in the setup process for matrix algebra, so the maintainer is the only person who has a good chance of debugging. You are advised in the posting guide to first send questions about rarely used packages ... along with the data ... to the package maintainer.
> 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)
> LinPred= sr~o2a+ o2r + (1|id) + (1|obs),
> RandDist= c("inverse-gamma", "gamma"),
> LinPredRandVariance=lambda~ 1 +(1|id) + (1|obs) ,
> RandDistRandVariance=c("gaussian", "gaussian"))
> LinPred = phi~o2a+ o2r + (1|id) + (1|obs),
> RandDist= c("gaussian", "gaussian"))
> 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 |
> [[alternative HTML version deleted]]
Please learn to use your mail client to send plain text. (It's not hard to do this with gmail.)
> R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
Alameda, CA, USA
More information about the R-help