0

I am trying to model some data using a MCMCglmm with outcome measure (HoNOSTotal) taken once a year over 4 years (Time) either in a treatment condition or not (BZ_ID).

I am very new at this but This is what I have so far:

k <- length(levels(BZData$HoNOSTotal))
I <- diag(k-1)
J <- matrix(rep(1, (k-1)^2), c(k-1, k-1))

prior1 <- list(R = list(fix=1, V = 0.5*(I+J), nu = 0.002),
           G = list(G1 = list(V = diag(1), nu = 0.002)))

mcmc<- MCMCglmm(HoNOSTotal ~ -1 + BZ_ID + Time + Time:BZ_ID,
            data = BZData,
            random = ~ us(-1 +ID),
            family = "gaussian",
            prior = prior1,
            nitt = 1000,
            burnin = 200)
summary(mcmc)

But I keep getting error message:

Error in priorformat(if (NOpriorG) { : 
  V is the wrong dimension for some prior$G/prior$R elements
In addition: Warning messages:
1: Unknown or uninitialised column: 'family'. 
2: Setting row names on a tibble is deprecated. 
3: Unknown or uninitialised column: 'MCMC_dummy'.

If anyone can offer a suggestion of how I fix this it would be appreciated

Emma
  • 1
  • 1
  • Due to the second warning I would first run `BZData <- as.data.frame(BZData)`. – Roland Aug 07 '18 at 12:08
  • Thank you so much Roland, but I am now getting a new error: `k <- length(levels(BZData$HoNOSTotal)) > I <- diag(k-1) Error in diag(k - 1) : invalid 'nrow' value (< 0) > J <- matrix(rep(1, (k-1)^2), c(k-1, k-1)) Error in matrix(rep(1, (k - 1)^2), c(k - 1, k - 1)) : invalid 'nrow' value (< 0) ` – Emma Aug 07 '18 at 13:15

0 Answers0