Closed dshemetov closed 3 weeks ago
@dshemetov
It'll be long enough that if you want this, we should merge. However, technically, you can already set method = "whatever"
:
library(epipredict) # dev branch
library(quantreg)
tib <- data.frame(y = rnorm(100), x1 = rnorm(100), x2 = rnorm(100))
rq_spec <- quantile_reg(quantile_levels = c(.1, .5, .9)) %>%
set_engine("rq") # default, method = "br"
translate(rq_spec) # what the call will look like
#> quantile reg Model Specification (regression)
#>
#> Main Arguments:
#> quantile_levels = c(0.1, 0.5, 0.9)
#>
#> Computational engine: rq
#>
#> Model fit template:
#> quantreg::rq(formula = missing_arg(), data = missing_arg(), weights = missing_arg(),
#> tau = c(0.1, 0.5, 0.9), method = "br", na.action = stats::na.omit,
#> model = FALSE)
rq_other <- quantile_reg(quantile_levels = c(.1, .5, .9)) %>%
set_engine(engine = "rq", method = "pfnb") # chosen arbitrarily
translate(rq_other) # what the call will look like
#> quantile reg Model Specification (regression)
#>
#> Main Arguments:
#> quantile_levels = c(0.1, 0.5, 0.9)
#>
#> Engine-Specific Arguments:
#> method = pfnb
#>
#> Computational engine: rq
#>
#> Model fit template:
#> quantreg::rq(formula = missing_arg(), data = missing_arg(), weights = missing_arg(),
#> tau = c(0.1, 0.5, 0.9), method = "pfnb", na.action = stats::na.omit,
#> model = FALSE)
f <- fit(rq_other, formula = y ~ ., data = tib)
parsnip::extract_fit_engine(f)$call # to see what it called
#> quantreg::rq(formula = y ~ ., tau = ~c(0.1, 0.5, 0.9), data = data,
#> na.action = stats::na.omit, method = ~"pfnb", model = FALSE)
Created on 2024-09-06 with reprex v2.1.1
Oh huh, well that's good enough for my needs, but might as well merge this, since at least it will be a documented option? Either way, not a big deal.
Checklist
Please:
DESCRIPTION
andNEWS.md
. Always increment the patch version number (the third number), unless you are making a release PR from dev to main, in which case increment the minor version number (the second number).epiprocess
version in theDESCRIPTION
file ifepiprocess
soonepipredict
andepiprocess
Change explanations for reviewer
Allows us to choose the fitting method used by
quantilereg::rq
.Magic GitHub syntax to mark associated Issue(s) as resolved when this is merged into the default branch