predict.glm_betaselect {betaselectr} | R Documentation |
Predict Method for a 'glm_betaselect' Object
Description
Compute the predicted
values in a model fitted by
glm_betaselect()
.
Usage
## S3 method for class 'glm_betaselect'
predict(
object,
model_type = c("beta", "standardized", "raw", "unstandardized"),
newdata,
...
)
Arguments
object |
A |
model_type |
The model from which the
the predicted values are computed.
For
|
newdata |
If set to a data
frame, the predicted values are
computed using this data frame.
The data must be unstandardized.
That is, the variables are of the
same units as in the data frame
used in |
... |
Arguments
to be passed to |
Details
It simply passes the model before
or after selected variables
are standardized to the
predict
-method of a glm
object.
IMPORTANT
Some statistics, such as prediction or confidence interval, which make use of the sampling variances and covariances of coefficient estimates may not be applicable to the models with one or more variables standardized. Therefore, they should only be used for exploratory purpose.
Value
It returns the output of stats::predict.glm()
.
Author(s)
Shu Fai Cheung https://orcid.org/0000-0002-9871-9448
See Also
glm_betaselect()
and stats::predict.glm()
Examples
data_test_mod_cat$p <- scale(data_test_mod_cat$dv)[, 1]
data_test_mod_cat$p <- ifelse(data_test_mod_cat$p > 0,
yes = 1,
no = 0)
logistic_beta_x <- glm_betaselect(p ~ iv*mod + cov1 + cat1,
data = data_test_mod_cat,
family = binomial,
to_standardize = "iv")
predict(logistic_beta_x)
predict(logistic_beta_x, model_type = "raw")