betta_random {breakaway} | R Documentation |
modelling total diversity with random effects
Description
This function extends betta() to permit random effects modelling.
Usage
betta_random(
chats = NULL,
ses,
X = NULL,
groups = NULL,
formula = NULL,
data = NULL,
p.digits = 3
)
Arguments
chats |
A vector of estimates of total diversity at different sampling
locations. Required with the |
ses |
The standard errors in |
X |
A numeric matrix of covariates corresponding to fixed effects. If
not supplied, an intercept-only model will be fit. Optional with the |
groups |
A categorical variable representing the random-effects groups
that each of the estimates belong to. Required with the |
formula |
A formula object of the form |
data |
A dataframe containing the response, response standard errors, covariates,
and grouping variable. Required with the |
p.digits |
(Optional) A number that specifies the number of digits to which p-values will be rounded. The default value is 3 digits. |
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. |
function.args |
A list containing values initially passed to betta_random. |
Author(s)
Amy Willis
References
Willis, A., Bunge, J., and Whitman, T. (2015). Inference for changes in biodiversity. arXiv preprint.
See Also
Examples
df <- data.frame(chats = c(2000, 3000, 4000, 3000),
ses = c(100, 200, 150, 180),
Cont_var = c(100, 150, 100, 50),
groups = c("a", "a", "a", "b"))
# formula notation
betta_random(formula = chats ~ Cont_var| groups,
ses = ses,
data = df)
# direct input
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"))