khb | R Documentation |
Compare two non-linear regression models using the KHB method
khb(reduced, full, corrected.se = FALSE, med.sandwich = NULL, glm.sandwich = FALSE, savefs = FALSE) ## S3 method for class 'khb' print(x, type = "summary", keyvar = NULL, disentangle = FALSE, ...)
reduced |
The reduced model to compare (withought mediators variables). This
must be a logistic or probit regression model fit using the |
full |
The full model to compare (including mediators variables). This
must be a logistic or probit regression model fit using the |
corrected.se |
Logical. If |
med.sandwich |
Logical. If |
glm.sandwich |
Logical. If |
savefs |
Logical. If |
x |
A khb object |
type |
Character. The type of information printed (see details). |
keyvar |
A character vector or |
disentangle |
Logical. If |
... |
Arguments passed to other methods. |
a khb object which is a list with the following elements:
sum_conf a summary table of the confounding and rescaling effects.
key a list of the confounding effect on each key variables (i.e. variable in the reduced model).
reduced the reduced model.
adjusted the adjusted model (with mediators residuals).
full the full model.
keyvar A character vector of the key variables (i.e. variable in the reduced model).
mediators A character vector of the mediators (i.e. the variable in the full model that are not in the reduced one).
Karlson KB, Holm A and Breen R (2012). Comparing Regression Coefficients Between Same-sample Nested Models Using Logit and Probit: A New Method. Sociological Methodology, 42(1), pp 286-313.
## Example: transition to higher education in Northern Ireland data(mvad, package="TraMineR") ## Build a binary covariate, TRUE if went to higher education HE <- rowSums(mvad[, 17:86]=="HE")>0 ## Our reduced models including Father unemployement (funemp) ## and type of compulsory school (Grammar) red <- glm(HE~funemp+Grammar, data=mvad, family=binomial("logit")) ## In the full model, we add the results at the end of compulsory schooling ## (gcse5eq). full <- glm(HE~Grammar+funemp+gcse5eq, data=mvad, family=binomial("logit")) ## Running the KHB method k <- khb(red, full) ## Printing the results for the funemp covariates only print(k, keyvar="funemp") ## Comparing the models print(k, type="models") ## Several mediators ## Here, we only have one covariate in the reduced model red <- glm(HE~funemp, data=mvad, family=binomial("logit")) full <- glm(HE~Grammar+gcse5eq+funemp, data=mvad, family=binomial("logit")) #' ## Running the KHB method k <- khb(red, full) ## Printing the results and disentangle the effect of each mediator print(k, disentangle=TRUE) ## Comparing the models print(k, type="models")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.