Compare two non-linear regression models using the KHB method

1 2 3 4 5 6 |

`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.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 | ```
## 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")
``` |

Questions? Problems? Suggestions? Tweet to @rdrrHQ or email at ian@mutexlabs.com.

Please suggest features or report bugs with the GitHub issue tracker.

All documentation is copyright its authors; we didn't write any of that.