Learn R Programming

breakaway (version 3.0)

betta_random: modelling total diversity with random effects

Description

This function extends betta() to permit random effects modelling.

Usage

betta_random(chats, ses, X = NA, groups)

Arguments

chats
A vector of estimates of total diversity at different sampling locations.
ses
The standard errors in chats, the diversity estimates.
X
A numeric matrix of covariates corresponding to fixed effects. If not supplied, an intercept-only model will be fit.
groups
A categorical variable representing the random-effects groups that each of the estimates belong to.

Value

table
A coefficient table for the model parameters. The columns give the parameter estimates, standard errors, and p-values, respectively. This model is only as effective as your diversity estimation procedure; for this reason please confirm that your estimates are appropriate and that your model is not misspecified. betta_pic may be useful for this purpose.
cov
Estimated covariance matrix of the parameter estimates.
ssq_u
The estimate of the heterogeneity variance.
ssq_g
Estimates of within-group variance. The estimate will be zero for groups with only one observation.
homogeneity
The test statistic and p-value for the test of homogeneity.
global
The test statistic and p-value for the test of model explanatory power.
blups
The conditional expected values of the diversity estimates (conditional on the random effects). Estimates of variability for the random effects case are unavailable at this time; please contact the maintainer if needed.

References

Willis, A., Bunge, J., and Whitman, T. (2015). Inference for changes in biodiversity. arXiv preprint.

See Also

betta; betta_pic

Examples

Run this code
betta_random(c(2000, 3000, 4000, 3000), c(100, 200, 150, 180),
             X = cbind("Int"=1, "Cont_var"=c(100, 150, 100, 50)),
             groups = c("a", "a", "a", "b"))

## handles missing data
betta_random(c(2000, 3000, 4000, 3000), c(100, 200, 150, NA),
             groups= c("a", NA, "b", "b"))

Run the code above in your browser using DataLab