# [R-sig-ME] Variance components analysis using a GLMM, how to insert a variance-covariance matrix in the model ?

Jesse Whittington jesse.whittington2 at gmail.com
Wed Jan 28 15:01:34 CET 2015

```Hi Célia,

Check out the rma function in the metafor package.  It is similar to the
RMark var.components.reml function.

I've used it for similar analyses with derived annual occupancy estimates.
You can input variance associated with each survival estimate - I'm not
sure if you can include covariance among estimates.

Here's an example of your model that I ran in RMark and metafor (sorry it's
not self contained).

# Multi-year occupancy model.
m <- try(mark(data=d.proc, ddl=d.ddl, model='RDOccupEG',
model.parameters=list(Epsilon=f.eps.t,  p=f.p), output=F, silent=T,
delete=T), silent=TRUE)
psi <- m\$results\$derived
psi\$year <- 0:(nrow(psi) - 1)
vcv <- m\$results\$derived.vcv
fixed.mat1 <- model.matrix( ~ 1 + year, data=psi)  # cannot use this with
only 2 years of data

# RMark Test for a linear Trend
m.trend <- try(var.components.reml(theta=psi\$estimate, design=fixed.mat1,
vcv=vcv), silent=TRUE)  # Linear model for significant trend

# metafor
m.trend <- rma(yi = estimate, sei = se, mods = ~ year, data = psi)

Warning:  I'm not a statistician, so I cannot guarentee that what I've done
is correct.

Jesse Whittington
Wildlife Biologist
Banff National Park

On Wed, Jan 28, 2015 at 2:17 AM, REZOUKI CELIA p1314815 <
celia.rezouki at etu.univ-lyon1.fr> wrote:

> Dear list,
>
> We are analysing the survival rates of a mammalian species from a
> capture-mark-recapture protocol. As a biologist, the usual way to
> proceed is to analyse capture histories (raw data) with a specific
> software named MARK (http://www.phidot.org/software/mark/) to run
> capture-mark-recapture analyses.
>
> Our problem is to get an estimation of a random effect of time using
> linear mixed models, not from the observed data, but from a coefficient
> vector (let's call it 'phi') representing annual estimates of the
> survival rates, and the empirical variance/covariance matrix (Rcov)
> obtained from MARK.
>
> We would like to use the output of the analyse (phis and Rcov) from MARK
> in a linear mixed-model in R to extract both a variance components and
> eventually, to model linear effects of different covariates such as
> time. The response variable being a proportion, it would be best to use
> a binomial family and hence, a generalized version of the mixed models.
>
> The model would look like:
> - response variable: logit(phi_t), the annual survival estimated from MARK
> - fixed effects : temporal trends (year entered as a covariable)
> - random effects : variance in survival around the temporal trend
> - Rcov, the empirical variance/covariance matrix from MARK is known and
> should be entered into the GLMM.
>
> It is unclear to us whether such an analysis is doable in R or not. The
> closest we found would be to use mcmcglmm but we would need confirmation
> and somes hint to start.
>
> In case you want to help, you can get a vector of estimated survival
> rates along with the empirical variance/covariance matrix returned by
> MARK from a subsample of our data here:
>
>
> Any help would be greatly appreciated.
>
> Célia
>
>
> --
>
> Célia Rezouki
> PhD student
>
> UMR CNRS 5558 - LBBE
> Biométrie et Biologie Évolutive
> UCB Lyon 1 - Bât. Grégor Mendel
> 43 bd du 11 novembre 1918
> 69622 VILLEURBANNE cedex
> _______________________________________________
> R-sig-mixed-models at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-sig-mixed-models
>

[[alternative HTML version deleted]]

```