View source: R/model_betta_random.R
betta_random | R Documentation |
This function extends betta() to permit random effects modelling.
betta_random( chats = NULL, ses, X = NULL, groups = NULL, formula = NULL, data = NULL, p.digits = 3 )
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 y ~ x | group. Required with
the |
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. |
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. |
Amy Willis
Willis, A., Bunge, J., and Whitman, T. (2015). Inference for changes in biodiversity. arXiv preprint.
betta
;
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"))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.