R: Alleged “missing values” when no values are act

2019-09-19 06:32发布

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?

0条回答
登录 后发表回答