fastEmuTest.Rd
Run robust score tests using a reduced version of the radEmu model
fastEmuTest(
constraint_cats,
estimate_full_model = TRUE,
Y,
X = NULL,
formula = NULL,
data = NULL,
test_kj = NULL,
cluster = NULL,
penalize = TRUE,
B = NULL,
fitted_model = NULL,
refit = TRUE,
return_wald_p = FALSE,
compute_cis = TRUE,
verbose = FALSE,
...,
model = NULL
)
a vector of category indices for categories that should be involved in the constraint and retained in any smaller joint model
If TRUE, this function will estimate parameters from full model (recommended) and run score tests with the reduced model. If FALSE, score tests will be run with the reduced model but parameter estimates will not be produced. Set to FALSE if you are running score tests in parallel and don't want to estimate parameters for the full model every time. Default is TRUE.
an n x J matrix or dataframe of nonnegative observations, or a phyloseq object containing an otu table and sample data.
an n x p matrix or dataframe of covariates (optional, either include X
or formula
and data
)
a one-sided formula specifying the form of the mean model to be fit
an n x p data frame containing variables given in formula
a data frame whose rows give coordinates (in category j and
covariate k) of elements of B to construct hypothesis tests for. If test_kj
is not provided, all elements of B save the intercept row will be tested.
a numeric vector giving cluster membership for each row of Y to be used in computing GEE test statistics. Default is NULL, in which case rows of Y are treated as independent.
logical: should Firth penalty be used in fitting model? Default is TRUE.
starting value of coefficient matrix (p x J). If not provided, B will be initiated as a zero matrix.
a fitted model produced by a call to radEmu::emuFit; to be provided if score tests are to be run without refitting the full unrestricted model. Default is NULL.
logical: if B or fitted_model is provided, should full model be fit (TRUE) or should fitting step be skipped (FALSE), e.g., if score tests are to be run on an already fitted model. Default is TRUE.
logical: return p-values from Wald tests? Default is FALSE. These can only be
returned if estimate_full_model
is TRUE.
logical: compute and return Wald CIs? Default is TRUE. These can only be
returned if estimate_full_model
is TRUE.
provide updates as model is being fitted? Defaults to TRUE.
Additional arguments to radEmu:::emuFit. See possible arguments with ?radEmu::emuFit
.
deprecated argument, default is "drop" to run the reduced model that drops all categories not in the constraint or being tested for each score test, "full" to run tests with the full joint model (equivalent to radEmu), or "agg" to run a different version of the reduced model in which all categories not in the constraint or being tested are aggregated together
A list containing elements 'coef', 'included_categories', and 'score_test_hyperparams'.
'coef' is a matrix with score test statistics and p-values for all parameters tested. 'Included_categories'
is a list of the categories used in the reduced model for each score test that is fit.
'score_test_hyperparameters' contains parameters and hyperparameters related to estimation under the
null, including whether or not the algorithm converged, which can be helpful for debugging.
The elements in 'Included_categories' and 'score_test_hyperparams' correspond to the tests described
in test_kj
and are in the same order.
If esttimate_full_model
is TRUE, then 'coef' will also include the estimates and optionally
confidence intervals and Wald test p-values for all parameters, estimated from the full model.
Additionally, if estimate_full_model
is TRUE, the return list will also include 'B', 'penalized', 'Y_augmented',
'z_hat', 'I', and 'Dy'. See the documentation in ?radEmu::emuFit
for a description of these
elements.