R: Alleged “missing values” when no values are actually missing for MCMCglmm

寵の児 提交于 2019-12-12 03:06:48

问题


I have a data structured as follows:

  • A is the count of positive cases in a cohort
  • B is the total count of the cohort minus A.
  • C is a binary variable
  • D- F are normally distributed continuous variables
  • G is 6 level factor

I am using MCMCglmm package in R to analyse this data to find which of the variables C - G affect A and B.

I have done this successfully using lme4's glmer function with success but now I wish to add more random effects which I have been advised will be better handled by the MCMC optimised variation. However, given the following function call

MCMCmod1 <- MCMCglmm(cbind(A, B) ~ C + D + E + F,
                     random = G,
                     prior = prior,
                     family ="multinomial2",
                     data = g)

(I appreciate the family may not be correct in this case)

Where

prior = list(R = list(V = 1, n = 0, fix = 1),
             G = list(
               G1 = list(V = 1, n = 1),
               G2 = list(V = 1, n = 1),
               G3 = list(V = 1, n = 1),
               G4 = list(V = 1, n = 1),
               G5 = list(V = 1, n = 1)))

I get the following error

Error in `[<-.data.frame`(`*tmp*`, , response.names, value = c(0, 0, 0,  :
missing values are not allowed in subscripted assignments of data frames

However, when I check my variables there are 100% no NAs.

Any ideas on the steps I can take to try to debug this?

来源:https://stackoverflow.com/questions/38055240/r-alleged-missing-values-when-no-values-are-actually-missing-for-mcmcglmm

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!