Function_name | Package_name | Use |
---|---|---|
aggregate | base/stats | To see summary by groups, e.g., by gender |
anova | base/stats | To compare models |
auc | pROC | To compute the AUC (area under the ROC curve) value |
BrierScore | DescTools | To calculate the Brier score |
coef | base/stats | To see the coefficients of a fitted model |
cor | base/stats | To see the correlation between numeric variables |
corrplot | corrplot | To visualize a correlation matrix |
createDataPartition | caret | To split a dataset into training and testing sets |
createFolds | caret | To create k folds based on the outcome variable |
crPlots | car | To see partial residual plot |
describeBy | psych | To see summary by groups, e.g., by gender |
glm | base/stats | To run generalized linear models |
group_by | dplyr | To group by variables |
hat | base/stats | To return a hat matrix |
ifelse | base | To set an condition, e.g., creating a categorical variable from a numerical variable based on a condition |
kable | knitr | To create a nice table |
layout | base/graphics | To specify plot arrangement |
lines | base/graphics | To draw a line graph |
lm | base/stats | To fit a linear regression |
lowess | base/stats | To smooth a scatter plot |
model.matrix | base/stats | To construct a design/model matrix, e.g., a matrix with covariate values |
ols_plot_resid_lev | olsrr | To visualize the residuals vs leverage plot |
ols_vif_tol | olsrr | To calculate tolerance and variance inflation factor |
predict | base/stats | `predict` is a generic function that is used for prediction, e.g., predicting probability of an event from a model |
R2 | caret | To calculate the R-squared value |
RMSE | caret | To calculate the RMSE value |
roc | pROC | To build a ROC curve |
sample | base | To take/draw random samples with or without replacement |
save.image | base | To save an R object |
spearman2 | Hmisc | To compute the square of Spearman's rank correlation |
summarize | dplyr | To see summary |
tapply | base | To apply a function over an array, e.g., to see the summary of a variable by gender |
train | caret | To fit the model with tuning hyperparameters |
trainControl | caret | To tune the hyperparameters, i.e., controlling the parameters to train the model |
varclus | Hmisc | We use the `varclus` function to identify collinear predictors with cluster analysis |
vif | car | To calculate variance inflation factor |
which | base | To see which indices are TRUE |
R functions (P)
The list of new R functions introduced in this Predictive factors lab component are below: