Description Usage Arguments Details Value Author(s)

Functions that develop structures needed for a mixed effect model

1 2 3 4 5 6 7 | ```
mixed.model.admb(formula,data)
mixed.model(formula,data,indices=FALSE)
mixed.model.dat(x,con,idonly,n)
reindex(x,id)
``` |

`formula` |
formula for mixed effect mode in the form used in lme4; ~fixed +(re1|g1) +...+(ren|gn) |

`data` |
dataframe used to construct the design matrices from the formula |

`x` |
list structure created by mixed.model.admb |

`con` |
connection to data file which contents will be appended |

`id` |
vector of factor values used to split the data up by individual capture history |

`idonly` |
TRUE, if random effects not crossed |

`n` |
number of capture history records |

`indices` |
if TRUE, outputs structure with indices into dm for random effects |

mixed.model.admb - creates design matrices and supporting index matrices for use of mixed model in ADMB

mixed.model - creates design matrices and supporting index matrices in an alternate list format that is not as easily used in ADMB

mixed.model.dat - writes to data file (con) for fixed and random effect stuctures

reindex - creates indices for random effects that are specific to the individual capture history; it takes re.indices, splits them by id and creates a ragged array by id (used.indices) with the unique values for that id. index.counts is the number of indices per id to read in ragged array. It then changes re.indices to be an index to the indices within the id from 1 to the number of indices within the id.

mixed.model.admb returns a list with elements re.dm, a combined design matrix for all of the random effects; and re.indices, matrix of indices into a single vector of random effects to be applied to the design matrix location. mixed.model returns a list (re.list) with an element for each random effect structure. The contents are a standard design matrix (re.dm) if indices==FALSE and a re.dm and re.indices which matches the structure of mixed.model.admb. mixed.model will be more useful with R than ADMB.

Jeff Laake

Embedding an R snippet on your website

Add the following code to your website.

For more information on customizing the embed code, read Embedding Snippets.