[R-sig-ME] how to specify priors in MCMCglmm?
Darren Norris
doon75 at hotmail.com
Thu May 7 02:33:18 CEST 2009
Dear all,
I would like to know how to specify priors for a MCMCglmm model with a
binary response. I have read the help (?MCMCglmm) and searched the best
I can through nabble R and this list.
Unfortunately if the answer is there I am too stupid to understand it.
>From the MCMCglmm tutorial I see how to code a univariate version - but
then I get lost about how to extend the prior specification to more
complex models.
I also do no understand the prior terminology or how / why to specify what I
need - so if at all possible I need an idiots guide how to specify the
priors.
I work for a conservation NGO and unfortunately we're not affiliated
with an academic institution so don't have access to books or journal
articles or any academic statistical support.
Any guidance would be much appreciated.
Many thanks,
Darren
R version 2.8.1 (2008-12-22)
i386-pc-mingw32
locale:
LC_COLLATE=English_United Kingdom.1252;LC_CTYPE=English_United Kingdom.1252;LC_MONETARY=English_United Kingdom.1252;LC_NUMERIC=C;LC_TIME=English_United Kingdom.1252
attached base packages:
[1] stats graphics grDevices utils datasets methods base
other attached packages:
[1] MCMCglmm_1.09 gtools_2.5.0 combinat_0.0-6 orthopolynom_1.0-1 polynom_1.3-4 pscl_1.03
[7] mvtnorm_0.9-4 ape_2.2-3 coda_0.13-4 Matrix_0.999375-18 lattice_0.17-17 tensorA_0.31
[13] corpcor_1.5.2 MASS_7.2-45
loaded via a namespace (and not attached):
[1] gee_4.13-13 grid_2.8.1 nlme_3.1-89
#make the data frame- using "sample" so data is not the same but the
important difference is between probability of events in "cD" and the
other two ("aD" and "bD")
# we coducted the work in 3 different places, each place has 3 habitat
types.
#Each habitat type has 2 groups of samples (3 samples per group) each
group in a habitat has a different type of bait.
#I am trying to model how the occurence of events was influenced by
habitat and bait. We checked samples repeatedly (atime).
#Specifying atime and agroup as random effects to deal with potential
pseudo replication.
aD<-sample(0:1,108,replace="True",prob=c(0.6,0.4));
bD<-sample(0:1,108,replace="True",prob=c(0.6,0.4));
cD<-rep(0,108);
aevent<-c(aD,bD,cD);
aplace<-rep(c(8,8,8,8,8,8,9,9,9,9,9,9,10,10,10,10,10,10),9);
ahabitat<-c(rep(1,108),rep(2,108),rep(3,108));
atime<-rep(c(0,1,2,4,8,24),54);
abait<-rep(c(1,1,1,1,1,1,2,2,2,2,2,2),27);
agroup<-paste(aplace,ahabitat,abait);
MyDf<-data.frame(aplace,agroup,aevent,ahabitat,atime,abait)
#-using prior code examples from the MCMCglmm tutorial (section 1.2:
produced April 17 2009), but priors are not right.
library(MCMCglmm);
prior = list(R = list(V = 1, n = 0, fix = 1), G = list(G1 = list(V = 1,n
= 0)));
MMCMm1 <- MCMCglmm(aevent ~ as.factor(ahabitat), random = ~agroup,
family = "categorical",prior=prior,data = MyDf, verbose = FALSE)
# I would like to specify, but don't know how to specify priors:
MMCMm2 <- MCMCglmm(aevent ~ as.factor(ahabitat)*as.factor(bait), random
= ~agroup + atime, family = "categorical",prior=prior,data = MyDf,
verbose = FALSE)
More information about the R-sig-mixed-models
mailing list