[R-sig-ME] Help with: Multivariate models with binary variables and variables with zipoisson distribution

Stacey Hannebaum @t@cey-h@nneb@um @end|ng |rom utu|@@@edu
Fri Feb 15 21:25:09 CET 2019


Hi,

I am trying to build a multivariate model to test for associations between
individual variation in behavioral and other traits. Essentially, I want to
derive two calculations from the model: (1) the repeatability of each of
the three traits within individuals and (2) the correlation between each
pair of traits and between each trait and fitness and trappability (the
latter two have one value per individual).
I have been working on this for some time and have reached a standstill.
Here are the main issues I am facing. Any suggestions would be very
appreciated.
(1) How should a binary variable be modelled? For now, I have modelled it
as Gaussian (with the assumption that 0s and 1s are drawn from some
underlying Gaussian process) so that I can calculate correlations but I
don’t know if this is reasonable. Any thoughts?
(2) I tried to run the below model but received the following error:
Error in priorformat(if (NOpriorG) { :
  V is the wrong dimension for some prior$G/prior$R elements
I am sure it has to do with modelling CHARGES as zipoisson - I think I need
to specify the structure for modelling the 0’s but I don’t know where to
start with this.

Below are the variables of interest in case this is useful to know:
logitTAPERETURN: logit-transformed latency to enter a nest once a novel
stimulus was applied / total possible time allowed for trial; trials were
terminated after 5 minutes whether or not bird entered nest; multiple
trials per individual.
CHARGES: number of times an individual attacked the novel stimulus (count
data with many zeros); multiple trials per individual. This could be
expressed as a rate (number of charges / latency to enter nest) but I
decided to model length of trial as a predictor variable using log(latency
to enter nest); trial repeated multiple times per subject
STATUSAFTER: whether the bird stayed in the nest or fled from the nest
(binary)
CAPTURES: number of times an individual was captured (count data with many
ones and no zeros); only one value per individual
RELFITNESS: number of fledglings for individual / mean number of fledglings
across all individuals; only one value per individual

prior_tr_c_sa_nc_f =
list(G=list(G1=list(V=diag(c(1,1,1,0.0001,0.0001),5,5),nu=1.002, fix = 4)),
                                  R=list(V=diag(5),nu=1.002))

I fixed CAPTURES and RELFITNESS because there is not within-individual
variation in these variables.

mcmc_tr_c_sa_nc_f_us <- MCMCglmm(cbind(logitTAPERETURN, CHARGES,
STATUSAFTER, CAPTURES, RELFITNESS) ~
                                            at.level(trait,1):(COLSIZE) +

at.level(trait,1):(TAPETRIALNUM) +

at.level(trait,1):(TAPENESTSTATUS) +
                                            at.level(trait,2):(COLSIZE) +

at.level(trait,2):(stTAPERETURN) +
                                            at.level(trait,2):(stTAPETEMP) +

at.level(trait,3):(stALARMTRIALNUM) +
                                            at.level(trait,3):(stALARMTIME)
+

at.level(trait,3):(stALARMWINDSP) +

at.level(trait,3):(STATUSBEFORE) +
                                            at.level(trait,4):(COLSIZE) +
                                            at.level(trait,5):(COLSIZE) +

at.level(trait,5):(stCLUTCHSIZE) - 1,
                                          random =~ us(trait):BAND,
                                          rcov =~ us(trait):units,
                                          family =
c("gaussian","zipoisson","gaussian","ztpoisson","gaussian"),
                                          prior = prior_tr_c_sa_nc_f,
                                          nitt=420000,
                                          burn=20000,
                                          thin=100,
                                          verbose = TRUE,
                                          data =
as.data.frame(MultivariateAnalysis20172018))


Thank you,

Stacey Hannebaum
Postdoctoral Research Associate

	[[alternative HTML version deleted]]



More information about the R-sig-mixed-models mailing list