# [R-sig-ME] MCMCglmm many correlated predictors

Ryan King c.ryan.king at gmail.com
Thu Jun 23 22:39:57 CEST 2011

```Hi, I have a structure where random predictors (not factors) come in
pairs.  Each draw of a pair is exchangeable.  Assuming independence of
the two (myz, myz2), I was looking to see if the second member of the
pair has the same distribution as the first using

initial.lm<-glm(phenotype~sex+snpmu+euro+snpmu2, family="binomial",data=mydata)

my.priormean<-mean(crossprod(mydata\$myz^2,initial.lm\$weights))/nrow(mydata\$myz)

my.priormean2<-mean(crossprod(mydata\$myz2^2,initial.lm\$weights))/nrow(mydata\$myz2)

testprior2<-list( R=list(V=1, fix=1),
G=list(G1=list(V=1/my.priormean/3, nu=3 ) ,
G2=list(V=1/my.priormean2/3, nu=3 ) ) )

mcmcbigout<-MCMCglmm(fixed=phenotype~sex+euro+snpmu+snpmu2,random=~idv(myz)
+idv(myz2)  , family = "categorical", data=mydata, nitt=30000,
thin=10, burnin=1, prior=testprior2, slice=TRUE, pr=TRUE, pl=TRUE)

Note that myz is a matrix.  I set the burnin to 1 here because I
wanted to see how long it needed to be and rerun it later (I'd also
like to be able to adaptively specify the burnin!).

Now I'd like to fit a correlation between the two predictors.  I don't
see much discussion of grouped non-factor predictors in the
coursenotes; that I could idh() a matrix at all was a pleasant
surprise.  Is there a way to set this up in MCMCglmm?  If so, how do I
specify the prior?

Thanks, Ryan King

```