Description Usage Arguments Details Value Examples
model_search
performs a step-wise log-linear model search, and
provides an overview of the model selection criteria AIC, AICc and BIC and the
estimated population size for the models in the search path.
1 2 3 4 5 6 7 8 9 | model_search(
x,
lists = NULL,
min_model = Freq ~ .,
max_model = Freq ~ .^2,
start_model = NULL,
year = NULL,
degree_year = NULL
)
|
x |
data frame with the lists and (optionally) covariates in the form of a
contingency table with the variable |
lists |
numeric vector with the column numbers of |
min_model |
formula specifying the minimal model considered in the model search.
Defaults to the main effects models |
max_model |
formula specifying the maximal model considered in the model search.
Defaults to the first-order interaction model |
start_model |
formula specifying the first model in the model search. The model
should be inside the range of models specified by |
year |
character string with the name of the covariate in |
degree_year |
degree of the orthogonal polynomials (1 = linear, 2 = quadratic,
3 = cubic, etc.) to be created for |
The lists in x
should be coded 0 and 1, with 0 denoting absence and 1 presence on the
list.
If the observations are made in subsequent, non-overlapping periods of time (e.g. years),
the covariate year
indicates the period the observation was made. The maximum value for
degree_year
is one minus the number of distinct periods.
Displays the degrees of freedom, deviance, AIC, AICc, BIC and population size estimates of the models in the search path, and returns a list with the following objects:
models |
the table with the fit statistics of the fitted models. |
formulas |
the formulas of the fitted models. |
coefs |
the parameter estimates of the fitted models. |
fits |
a list with the fitted frequencies of the models in the search path. |
minima |
a vector with the respective unscaled minima of the AIC, AICc and BIC. |
d |
the data frame |
d_year |
the data frame |
obs |
a vector distinguishing between observations and structural zeros in |
lists |
a vector with the column numbers of |
year |
a scalar indicating the column number of the variable |
1 2 3 | # Model search with 1st-order interactions term only, and quadratic contrasts for year
search <- model_search(x = simdat, lists = 1:4, year = "Y", degree_year = 2)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.