| Type: | Package |
| Title: | Additional Predictor with Maximum Effect Size |
| Version: | 0.2.3 |
| Description: | Methods of selecting one from many numeric predictors for a regression model, to ensure that the additional predictor has the maximum effect size. |
| RoxygenNote: | 7.3.3 |
| Encoding: | UTF-8 |
| License: | GPL-2 |
| Depends: | R (≥ 4.5), groupedHyperframe (≥ 0.3.0) |
| Language: | en-US |
| URL: | https://github.com/tingtingzhan/maxEff, https://tingtingzhan.quarto.pub/groupedhyperframe/maxEff.html, https://tingtingzhan-groupedhyperframe.netlify.app/maxEff.html |
| Imports: | parallel, doParallel, foreach, caret, rpart, spatstat.geom |
| Suggests: | survival |
| NeedsCompilation: | no |
| Packaged: | 2026-03-02 17:24:06 UTC; tingtingzhan |
| Author: | Tingting Zhan |
| Maintainer: | Tingting Zhan <tingtingzhan@gmail.com> |
| Repository: | CRAN |
| Date/Publication: | 2026-03-02 17:40:03 UTC |
maxEff: Additional Predictor with Maximum Effect Size
Description
Methods of selecting one from many numeric predictors for a regression model, to ensure that the additional predictor has the maximum effect size.
Author(s)
Maintainer: Tingting Zhan tingtingzhan@gmail.com (ORCID)
See Also
Useful links:
-
https://tingtingzhan.quarto.pub/groupedhyperframe/maxEff.html
-
https://tingtingzhan-groupedhyperframe.netlify.app/maxEff.html
Additional logical Predictor
Description
Additional logical Predictor
Usage
add_dummy(
start.model,
x,
data = eval(start.model$call$data),
mc.cores = getOption("cores"),
...
)
Arguments
start.model |
|
x |
one-sided formula,
numeric predictors |
data |
(optional) data.frame in the model call of |
mc.cores |
Value
The function add_dummy() returns an object of class 'add_dummy'.
Additional logical Predictor via Repeated Partitioning
Description
Additional logical Predictor via Repeated Partitioning
Usage
add_dummy_partition(
start.model,
x,
data = eval(start.model$call$data),
times,
mc.cores = getOption("cores"),
...
)
Arguments
start.model |
|
x |
one-sided formula,
numeric predictors |
data |
(optional) data.frame in the model call of |
times, ... |
additional parameters of function createDataPartition or |
mc.cores |
Value
The function add_dummy_partition() returns an object of class 'add_dummy'.
Additional Predictor as numeric
Description
Additional predictor as numeric.
Usage
add_numeric(
start.model,
x,
data = eval(start.model$call$data),
mc.cores = getOption("cores"),
...
)
Arguments
start.model |
|
x |
one-sided formula to specify
the numeric predictors |
data |
|
mc.cores |
|
... |
additional parameters, currently of no use |
Details
The function add_numeric() treats each additional predictor as a numeric variable,
and updates the starting model with each additional predictor.
Value
The function add_numeric() returns an add_numeric object,
which is a listof objects with an internal class 'add_numeric_'.
Get Cutoff Value from a Dichotomizing Rule node1()
Description
To get the cutoff value from a Dichotomizing Rule node1().
Usage
get_cutoff(x)
## S3 method for class 'node1'
get_cutoff(x)
Arguments
x |
see Usage |
Value
The S3 method get_cutoff.node1() returns a numeric scalar.
labels.add_dummy
Description
Usage
## S3 method for class 'add_dummy'
labels(object, ...)
Arguments
object |
a add_dummy object |
... |
.. |
Value
The S3 method labels.add_dummy() returns a character vector.
labels.add_numeric
Description
Usage
## S3 method for class 'add_numeric'
labels(object, ...)
Arguments
object |
a add_numeric object |
... |
.. |
Value
The S3 method labels.add_numeric() returns a character vector.
Find labels from node1
Description
Usage
## S3 method for class 'node1'
labels(object, ...)
Arguments
object |
a node1 object |
... |
additional parameters, currently not in use |
Value
The S3 method labels.node1() returns a character scalar.
Dichotomize via 1st Node of Recursive Partitioning
Description
Dichotomize via 1st Node of Recursive Partitioning
Usage
node1(object, nm = as.symbol(rownames(s)[1L]), ...)
Arguments
object |
an rpart.object |
nm |
|
... |
additional parameters, currently not in use |
Value
The function node1() returns an object of class 'node1',
which is a function
with one parameter newx taking a double vector.
Note
In future integer and factor predictors will be supported.
References
https://tingtingzhan.quarto.pub/groupedhyperframe/object/node1.html
Examples
rpart::rpart(
formula = survival::Surv(pgtime, pgstat) ~ age,
data = rpart::stagec[1:135,],
cp = .Machine$double.eps, maxdepth = 2L
) |>
node1()
Predict by node1()
Description
Predict by node1()
Usage
## S3 method for class 'node1'
predict(object, newdata, ...)
Arguments
object |
a node1 object |
newdata |
a data.frame or hyperframe |
... |
place holder for |
Regression Models with Optimal Dichotomizing Predictors
Description
Regression models with optimal dichotomizing predictor(s), used either as boolean or continuous predictor(s).
Usage
## S3 method for class 'add_dummy'
predict(object, ...)
## S3 method for class 'add_dummy_'
predict(object, newdata, ...)
Arguments
object |
an |
... |
additional parameters, currently not in use |
newdata |
data.frame, candidate numeric predictors |
Value
The S3 method predict.add_dummy() returns a listof regression models.
The function predict.add_dummy_() returns a updated regression model.
Regression Models with Optimal Dichotomizing Predictors
Description
Regression models with optimal dichotomizing predictor(s), used either as boolean or continuous predictor(s).
Usage
## S3 method for class 'add_numeric'
predict(object, ...)
## S3 method for class 'add_numeric_'
predict(object, newdata, ...)
Arguments
object |
an add_numeric object |
... |
additional parameters of function |
Value
The S3 method predict.add_numeric() returns a listof regression models.
print.add_dummy
Description
Usage
## S3 method for class 'add_dummy'
print(x, ...)
Arguments
x |
an object returned from functions
|
... |
additional parameters, currently not in use |
Details
..
Value
The S3 method print.add_dummy() does not have a returned value
print.add_numeric
Description
Usage
## S3 method for class 'add_numeric'
print(x, ...)
Arguments
x |
a add_numeric object |
... |
.. |
sort_by.add_
Description
Usage
## S3 method for class 'add_'
sort_by(x, y, ...)
Arguments
x |
an object returned from functions
|
y |
|
... |
additional parameters of S3 generic sort_by, etc. |
Details
The S3 method sort_by.add_() sorts the elements of an 'add_' object by a certain criterion y.
We suggest using y = abc(effsize) and decreasing = TRUE order of the absolute values of the effect sizes of additional predictor.
Value
The S3 method sort_by.add_() returns an object of the same class as input x.
Split-Dichotomized Regression Model
Description
Split-dichotomized regression model.
Usage
splitd(start.model, x_, x, data, id, ...)
Arguments
start.model |
a regression model |
x_ |
|
x |
|
data |
|
id |
logical vector, indices of training ( |
... |
additional parameters, currently not in use |
Value
The function splitd() returns a function,
the dichotomizing rule \mathcal{D} based on the training set (y_0, x_0),
with additional attributes
attr(,'p1')double scalar,
p_1 = \text{Pr}(\mathcal{D}(x_1)=1)attr(,'effsize')double scalar, univariable regression coefficient estimate of
y_1\sim\mathcal{D}(x_1)
Split-Dichotomized Regression Model
The function splitd() performs a univariable regression model on the test set with a dichotomized predictor, using a dichotomizing rule determined by a recursive partitioning of the training set.
Specifically, given a training-test sample split,
find the dichotomizing rule
\mathcal{D}of the predictorx_0given the responsey_0in the training set (via functionnode1());fit a univariable regression model of the response
y_1with the dichotomized predictor\mathcal{D}(x_1)in the test set.
Currently the Cox proportional hazards (coxph) regression for Surv response, logistic (glm) regression for logical response and linear (lm) regression for gaussian response are supported.
Stratified Partition
Description
A variation of createDataPartition,
to split Surv y by survival status
instead of the percentiles survival time.
Usage
statusPartition(y, times, p = 0.8, ...)
Arguments
y |
response |
times |
positive integer scalar |
p |
double scalar between 0 and 1,
percentage |
... |
additional parameters, currently not in use |
Details
See vignette('intro', package = 'maxEff').
Value
The function statusPartition() returns a length-n listof
integer vectors.
In each integer vector indicates the training subjects.
Note
The function caTools::sample.split is not what we need.
References
https://tingtingzhan.quarto.pub/groupedhyperframe/nonS3/statusPartition.html
S3 Method Dispatches to 'add_dummy' Class
Description
S3 Method Dispatches to 'add_dummy' Class
Usage
## S3 method for class 'add_dummy'
subset(x, subset, ...)
Arguments
x |
an object returned from functions |
subset |
|
... |
additional parameters of function |
Details
The S3 method subset.add_dummy(), default subset (p1>.15 & p1<.85).
See explanation of p_1 in function splitd().
Value
The S3 method subset.add_dummy() returns a add_dummy() object.