mcm {MCM} | R Documentation |
Estimate and Test Inter-generational Social Mobility Effect on an Outcome
Description
This function implements the mobility contrast model designed for estimating and testing inter-generational mobility effect on an outcome.
Usage
mcm(
formula,
data,
weights = 1,
na.action = na.omit,
origin,
destination,
family = gaussian(),
contrasts = NULL,
gee = FALSE,
id = NULL,
corstr = "exchangeable",
displayresult = TRUE,
...
)
Arguments
formula |
an object of class "formula" (or one that can
be coerced to that class): a symbolic description of the model
to be fitted. A typical model used in studying social mobility
takes the form |
data |
an optional data frame, list or environment (or object coercible by as.data.frame to a data frame) containing the variables in the model. If not found in data, the variables are taken from environment(formula), typically the environment from which the function is called. |
weights |
an optional vector of unit-level sampling weights to be used in analysis. Should be NULL or a numeric vector. |
na.action |
a function which indicates what should
happen when the data contain NAs.The default is set by the
|
origin |
a character indicating the column name of origin. |
destination |
a character indicating the column name of destination. |
family |
a character string, a function or the result of a call to a family function describing the error distribution and link function to be used in the model. |
contrasts |
an optional list. The default is set as sum-to-zero contrast. |
gee |
logical. Should gee be used in estimating the model? |
id |
a vector which identifies the clusters, which is required while
|
corstr |
a character string specifying
the correlation structure.
The following are permitted: |
displayresult |
logical. Should model results be displayed
after estimation. The default is |
... |
additional arguments to be passed to the function. |
Value
A list containing:
model |
Fitted generalized models of outcome on predictors.
See more on function |
origin_main |
Estimated main effects of origin. |
destination_main |
Estimated main effects of destination. |
mobility_estimates |
Estimated mobility effects. |
mobility_se |
Standard errors of the estimated mobility effects. |
mobility_sig |
Statistical significance of the the estimated mobility effects. |
Examples
library(MCM)
data('sim_moderate_het')
mcm(response ~ origin * destination, data = sim_moderate_het,
origin = "origin",destination="destination")