I am working with a colleague on a known-fate analysis of telemetered turtles over an 11 year period under three treatment groups and with time-varying body size. My colleague fit 10 models using RMark (various combinations of effects of group, size, time, and some interactions) and then model-averaged the real coefficients using model.average().
I tried to recreate the analysis, but I received the following error.
> res.modavg <- model.average(results, vcv = FALSE, drop = FALSE)
Error in compute.real(model, design = model$design.matrix, se = TRUE, :
Input design matrix must only have numeric values. Use find.covariates and fill.covariates to fill in covariate values
To find a solution, I tried various things. I tried digging into the design matrix, and looked at it's structure; the object, which is produced by 'make.design.data()', looks like this:
List of 2
$ S :'data.frame': 18 obs. of 8 variables:
..$ par.index : int [1:18] 1 2 3 4 5 6 7 8 9 10 ...
..$ model.index: num [1:18] 1 2 3 4 5 6 7 8 9 10 ...
..$ group : Factor w/ 3 levels "1","2","3": 1 1 1 1 1 1 2 2 2 2 ...
..$ age : Factor w/ 6 levels "1","2","3","4",..: 1 2 3 4 5 6 1 2 3 4 ...
..$ time : Factor w/ 6 levels "2022","2017",..: 2 3 4 5 6 1 2 3 4 5 ...
..$ Age : num [1:18] 1 2 3 4 5 6 1 2 3 4 ...
..$ Time : num [1:18] 0 1 2 3 4 5 0 1 2 3 ...
..$ group : Factor w/ 3 levels "1","2","3": 1 1 1 1 1 1 2 2 2 2 ...
$ pimtypes:List of 1
..$ S:List of 1
.. ..$ pim.type: chr "all"
But I didn't really know what to do.
One thing that stood out to me was when I restricted the models to remove any models with the time-varying body size covariate, then the model.average() calls work.
To better diagnose the issue, my colleague sent me their .Rdata for a successful session when the code ran to entirety, which included all of the objects that were produced by functions. I loaded these data and, using the objects produced by my colleagues script/RMark/MARK, the model.average() function works fine. However, when I re-run the model estimation set with my version of MARK (which I downloaded yesterday morning), the model.average() calls fail. My suspicion is that there may be a detail associated with new version of MARK, where it produces a file structure format that does not work well with the most recent version of RMark's model.average() function.
I am using a brand-new M2 Mac and the most recent version of MARK. My colleague is using an Intel Mac and likely a two-year old version of MARK, but we are having a hard time identifying version numbers for his MARK. We are both using the same version of R and RMark. We shared the outputs produced by MARK when model-fitting; while all the calculations and model structure look the same (BIC, DIC, AIC, deviance, etc.), some of the structure of those outputs (the text that runs through the R console while models are being fit) differ.
If anyone knows how to solve this problem, that would be of great interest to us. Thank you!