View source: R/ordinal_reg-VGAM.R
| VGAM_vglm_wrapper | R Documentation |
VGAMThese wrappers reorganize arguments into proper calls to VGAM::vglm() and
VGAM::vgam(), which specialize to several families of ordinal regression
models. The standardized argument values used by parsnip::ordinal_reg() and
parsnip::gen_additive_mod() are matched and converted to the values native
to VGAM within the wrappers.
VGAM_vglm_wrapper(
formula,
data,
family = "cumulative",
link = "logitlink",
parallel = FALSE,
Thresh = NULL,
...,
call = rlang::caller_env()
)
VGAM_vgam_wrapper(
formula,
data,
family = "cumulative",
link = "logitlink",
parallel = FALSE,
Thresh = NULL,
...,
call = rlang::caller_env()
)
values_ordinal_link_VGAM
values_threshold_structure_VGAM
formula |
The formula to pass. |
data |
The data frame to pass. |
family |
The odds link function; either a standardized dial value
( |
link |
The ordinal link function; either a standardized dial value (e.g.
|
parallel |
Logical; whether predictor effects are shared across
thresholds. It corresponds to the standardized |
Thresh |
Character; the threshold constraint pattern. It corresponds to
the standardized |
... |
Additional arguments to pass. |
The vector values_ordinal_link_VGAM extends the default ordinal_link
options encoded in dials::values_ordinal_link to those accepted by
VGAM::vglm() and VGAM::vgam().
The vector values_threshold_structure_VGAM extends the default
threshold_structure options encoded in
dials::values_threshold_structure to those accepted by VGAM::vglm()
and VGAM::vgam().
vgam prediction with s() terms requires a VGAM version later than 1.1-9.
ordered does not yet support the sm.os() and sm.ps() smoother terms
available to VGAM::vgam(), which VGAM recommends instead of s() for
certain models; see VGAM::vgam() (WARNING section).
Note that VGAM::vglm() and VGAM::vgam() treat the rows of data
as the units of observation: Compressed data with one row per predictor
set will be understood as having a multinomial-valued outcome; only
expanded data with one row per case will be understood as having a
single-valued ordinal outcome. (This divide cannot be bridged by passing a
column of counts to the weights argument.) These wrappers require a
single ordinal outcome column and therefore do not accept the convenient
cbind(y1, y2, ...) ~ x1 + x2 + ... encoding commonly used in VGAM.
An object of S3 parent class VGAM and primary classes vglm or
vgam as returned by VGAM::vglm() and VGAM::vgam().
values_ordinal_link_VGAM
dials::ordinal_link(values = values_ordinal_link_VGAM)
values_threshold_structure_VGAM
dials::threshold_structure(values = values_threshold_structure_VGAM)
house_data <-
MASS::housing[rep(seq(nrow(MASS::housing)), MASS::housing$Freq), -5]
if (utils::packageVersion("VGAM") == package_version("1.1.9")) {#VGAM=1.1-9
# fit wrapper for linear model
( fit_orig <- VGAM::vglm(
Sat ~ Type + Infl + Cont,
family = VGAM::sratio(
link = "probitlink", parallel = TRUE, threshold = "symmetric0"
),
data = house_data
) )
( fit_wrap <- VGAM_vglm_wrapper(
Sat ~ Type + Infl + Cont,
family = "sratio",
link = "probitlink", parallel = TRUE, Thresh = "symmetric_zero",
data = house_data
) )
# fit wrapper for additive model
( fit_orig <- VGAM::vgam(
Sat ~ Type + Infl + Cont,
family = VGAM::cratio(
link = "clogloglink", parallel = TRUE, threshold = "symmetric0",
),
data = house_data
) )
( fit_wrap <- VGAM_vgam_wrapper(
Sat ~ Type + Infl + Cont,
family = "cratio",
link = "cloglog", parallel = TRUE, Thresh = "symmetric0",
data = house_data
) )
}#VGAM=1.1-9
if (utils::packageVersion("VGAM") > package_version("1.1.9")) {#VGAM>1.1-9
# fit wrapper for linear model
( fit_orig <- VGAM::vglm(
Sat ~ Type + Infl + Cont,
family = VGAM::sratio(
link = "probitlink", parallel = TRUE, Thresh = "symm0"
),
data = house_data
) )
( fit_wrap <- VGAM_vglm_wrapper(
Sat ~ Type + Infl + Cont,
family = "sratio",
link = "probitlink", parallel = TRUE, Thresh = "symmetric_zero",
data = house_data
) )
# fit wrapper for additive model
( fit_orig <- VGAM::vgam(
Sat ~ Type + Infl + Cont,
family = VGAM::cratio(
link = "clogloglink", parallel = TRUE, Thresh = "symm0",
),
data = house_data
) )
( fit_wrap <- VGAM_vgam_wrapper(
Sat ~ Type + Infl + Cont,
family = "cratio",
link = "cloglog", parallel = TRUE, Thresh = "symm0",
data = house_data
) )
}#VGAM>1.1-9
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.