MCMCglmm covariance matrix question
Greetings Dr. Bolker, I apologize for the delayed response. Your idea would work ideally. Would you know if it was possible to set the value as 0? For example- https://stat.ethz.ch/pipermail/r-sig-mixed-models/2015q4/024036.html Here they use antedependance model and fix the value as 0. Let me know what you think. Regards, Sri.
On Wed, Dec 2, 2020 at 4:07 PM Ben Bolker <bbolker at gmail.com> wrote:
That seems quite difficult to set up in a single analysis. Would it work to analyze 8 of the traits with one model, and then analyze the other trait (which you want to treat independently) with a separate, univariate model? On 12/2/20 10:56 AM, Srivats Chari wrote:
Greetings, I'm trying to run a multivariate MCMCglmm with 9 traits. My traits are measured mostly at the same time except for 1 trait which is measured
only
once or twice per individual. After reading a some literature on this I have a basic idea on how to structure my dataset. But the problem I am facing is that I need my covariance matrix to be different. I want my covariance matrix to exclude the 1 trait so that all trait can COvary together except for a particular one! So there won't be any within-individual COvariation between the particular trait and others. creating a sample dataset- df<- data.frame(ani_id = as.factor(1:10),
sex=c("male","female","male","female","male","female","male","female","male","female"),age=c("young","adult","young","adult","adult","young","young",
"adult","adult","adult"),value=runif(200,min=1, max=5),year=ceiling(runif(200,min=2010, max=2019)), PC1=runif(200,
min=0.1,
max=0.9))
df$value[5:9]<- NA
df$trait_id<- as.factor(paste("T",rep(1:10, each=20), sep="_"))
## My Prior
prior1 <- list(R = list(V =diag(10), nu = 0.002),
G = list(G1 = list(V = diag(10), nu = 0.002,
alpha.mu = rep(0, 10),
alpha.V = diag(10)*25^2)))
## MCMC model
mcmc_trial1<-MCMCglmm(scale(value) ~ factor(sex)+
scale(year) + scale(year^2)+
scale(PC1)+ scale(PC1^2)+
factor(age),
random =~ us(trait_id):ani_id,
rcov =~ idh(trait_id):units,
family = c("gaussian"),
prior = prior1,
nitt=10000,
burnin=1000,
thin=10,
verbose = TRUE,
pr=TRUE,
data = df)
So when I see a covariance matrix I want the trait T1 to not covary with
any other trait.
T1 T2 T3 T4 T5 T6 T7 T8 T9 T10
T1 0,1 0 0 0 0 0 0 0 0 0
T2 0 0,1 0,1 0,1 0,1 0,1 0,1 0,1 0,1 0,1
T3 0 0,1 0,1 0,1 0,1 0,1 0,1 0,1 0,1 0,1
T4 0 0,1 0,1 0,1 0,1 0,1 0,1 0,1 0,1 0,1
T5 0 0,1 0,1 0,1 0,1 0,1 0,1 0,1 0,1 0,1
T6 0 0,1 0,1 0,1 0,1 0,1 0,1 0,1 0,1 0,1
T7 0 0,1 0,1 0,1 0,1 0,1 0,1 0,1 0,1 0,1
T8 0 0,1 0,1 0,1 0,1 0,1 0,1 0,1 0,1 0,1
T9 0 0,1 0,1 0,1 0,1 0,1 0,1 0,1 0,1 0,1
T10 0 0,1 0,1 0,1 0,1 0,1 0,1 0,1 0,1 0,1
Where I am stuck is I do not know how to structure the covariance matrix
to
exclude T1.
Any suggestions or help is much appreciated. :)
Regards,
Srivats.
[[alternative HTML version deleted]]
_______________________________________________ R-sig-mixed-models at r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-sig-mixed-models
_______________________________________________ R-sig-mixed-models at r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-sig-mixed-models