glmm: Fit Generalized Linear Mixed-Effects Models Using State Space...

Description Usage Arguments Examples

Description

Function glmm estimates GLMM using methods basec on state space modelling.

Usage

1
2
3
4
5
glmm(response.var, grouping.var, fixed.formula, random.formula, data,
  distribution, init.random, init.dispersion, init.fixed,
  correlating.effects = TRUE, REML = TRUE, estimate.dispersion,
  return.model = TRUE, nsim = 0, maxiter = 50, maxeval = 1000,
  xtol_rel = 1e-06, ...)

Arguments

response.var

Name of the response variable in data.

grouping.var

Name of the grouping variable in data. Only one grouping variable is allowed.

data

Optional data frame environment containing the variables in the model.

distribution

Character vector defining the distributions used for each group. Either length of one (same distribution for all groups) or length of p, number of groups. Default is "gaussian".

init.random

Initial values for random effect covariances.

init.dispersion

Initial values for dispersion paremeters.

init.fixed

Initial values for fixed effects.

correlating.effects

Logical. Default is TRUE.

estimate.dispersion

Logical. Is the dispersion parameter estimated or fixed.

return.model

Logical. Is the estimated model returned in output.

nsim

Integer. Number of independent samples used in importance sampling. Default is 0, which corresponds to Laplace approximation.

maxiter

Integer. Number of iterations for in iterative weighted least squares.

method

"REML", "REML-ML" or "ML". "REML-ML" uses estimates obtained from REML for ML estimation. Note that ML is much slower.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
data(butterfly)

require(lme4)
system.time(fit.SSglmm.reml<-glmm(response.var="Colias", grouping.var="site", fixed=~habitat + building + urbanveg,random=~1,
                                 REML=TRUE,data=butterfly,distribution="poisson",return.model=TRUE))

system.time(fit.SSglmm.ml<-glmm(response.var="Colias", grouping.var="site", fixed=~habitat + building + urbanveg,random=~1,
                               REML=FALSE,data=butterfly,distribution="poisson",return.model=TRUE))

fit.glmer<-glmer(Colias ~ habitat + building + urbanveg + (1|site),
                family=poisson, data=butterfly,control=glmerControl(optimizer = "bobyqa"))

sqrt(fit.SSglmm.reml$random$P)
sqrt(fit.SSglmm.ml$random$P)
VarCorr(fit.glmer)

fixef(fit.glmer)
fit.SSglmm.ml$fixed$coef
fit.SSglmm.reml$fixed$coef

require(mvabund)
data(spider)
x<-apply(spider$x,2,rep,times=12)
dataspider<-data.frame(species=rep(names(spider$abund),each=28),abund=unlist(spider$abund),x)
out<-glmm(response.var="abund", grouping.var="species", fixed=~soil.dry+bare.sand, random=~1,
data=dataspider,distribution="poisson")

out2<-glmm(response.var="abund", grouping.var="species", fixed=~soil.dry+bare.sand,
data=dataspider,distribution="poisson")
fit<-manyglm(mvabund(spider$abund)~soil.dry+bare.sand,data=data.frame(spider$x),family="poisson")

helske/StateSpaceGLMM documentation built on May 17, 2019, 3:39 p.m.