Learn R Programming

smof (version 1.2.2)

smof-package: Scoring Methodology for Ordered Factors

Description

Starting from a given object representing a fitted model (within a certain set of model classes) whose linear predictor includes some ordered factor(s) among the explanatory variables, a new model is constructed and fitted where each named factor is replaced by a single numeric score, suitably chosen so that the new variable produces a fit comparable with the standard methodology based on a set of polynomial contrasts.

Arguments

Author

Author: Adelchi Azzalini [aut, cre] (<https://orcid.org/0000-0002-7583-1269>) Maintainer: Adelchi Azzalini <adelchi.azzalini@unipd.it>

Details

The DESCRIPTION file: tools:::Rd_package_DESCRIPTION("smof") tools:::Rd_package_indices("smof")

References

Azzalini, A. (2023). On the use of ordered factors as explanatory variables. Stat 12, e624. tools:::Rd_expr_doi("10.1002/sta4.624")

Examples

Run this code
library(datasets)
data(esoph)
contrasts(esoph$agegp, 2) <- contr.poly(6) # optional
contrasts(esoph$tobgp, 1) <- contr.poly(4) # optional
obj1 <- glm(cbind(ncases, ncontrols) ~ agegp + tobgp + alcgp, family=binomial(), data=esoph)        
out0 <- smof(obj1, esoph, "alcgp")
print(summary(out0$object)) 

Run the code above in your browser using DataLab