Description Usage Arguments Value Examples
Create a Generalised Linear Model (glm) from a dataset and a given set of variables, then make predictions from the model, either on the original data or a new dataset.
1 2 3 4 5 6 7 8 9 | glm_predict(
model,
target,
pos_class = 1,
neg_class = 0,
threshold = 0.5,
newdata = NULL,
...
)
|
model |
Fitted |
target |
Target name (must be present as a column in the model object). This is the y variable when creating a |
pos_class |
Positive class label. default= |
neg_class |
Negative class label. default= |
threshold |
Probability threshold for predicting positive class. Must be between 0 and 1 (exclusive). default= |
newdata |
New data to make predictions on. By default, |
... |
Other parameters to be passed into the |
Augment object with a column .prediction
that contains the predicted class for each example.
1 2 3 4 | require(dplyr)
cancer_model <- glm(malignant ~ texture_mean, data=cancer_clean, family="quasibinomial")
glm_predict(cancer_model, "malignant")
glm_predict(cancer_model, "malignant", threshold=0.8)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.