I am trying to fit a model with three outcomes. Since my data is multilevel and bayesian regression modeling gives more flexibility, I am trying to fit a multilevel model using INLA.
I have three outcomes. I was wondering if I could fit a single multivariate model. I went through help pages with examples of multiple likelihood and also referred to another paper that uses bivariate outcome and applied INLA: "A latent process model for forecasting multiple time series in environmental public health surveillance", Morrison et al 2016.
n <- nrow(data_in)
Y <- matrix(NA, n*3, 3)
Y[1:n, 1] <- data_in$Outcome1
Y[(1+n):(3*n), 1] <- NA # faked observations
Y[(1+n):(2*n), 2] <- data_in$Outcome2 # actual observations
Y[c(1:n,((2*n+1):(3*n)) ), 2] <- NA # faked observations
Y[(1+2*n):(3*n), 3] <- data_in$Outcome3 # actual observations
Y[c(1:(2*n) ), 3] <- NA # faked observations
x <- data_in[,c("P_ID", "var1","var2","var3")]
X <- rbind(x,x,x)
Y <- data.frame(Y)
names(Y) <- c("Outcome1","Outcome2","Outcome3")
formula_tv = list(Outcome1, Outcome2, Outcome3) ~ var1 + var2 + var3 + f(P_ID, model="iid")
system.time(
result_tv <- inla(formula_tv, family = c("Gaussian","Gaussian","Gaussian"), data = cbind(Y,X), control.compute=list(dic=TRUE) )
)
summary(result_tv)
I guess the above model assumes that outcome is a trivariate normal distribution and returns single set of coefficients for the latent field.
I was wondering if there is a way to get three sets of coefficients, one for each outcome; similar to a multivariate regression model, that also accounts for covariance between outcomes.