| Title: | Clustered Random Forests for Optimal Prediction and Inference of Clustered Data |
|---|---|
| Description: | A clustered random forest algorithm for fitting random forests for data of independent clusters, that exhibit within cluster dependence. Details of the method can be found in Young and Buehlmann (2025) <doi:10.48550/arXiv.2503.12634>. |
| Authors: | Elliot H. Young [aut, cre] |
| Maintainer: | Elliot H. Young <[email protected]> |
| License: | GPL-3 |
| Version: | 1.1.0 |
| Built: | 2026-05-15 06:10:16 UTC |
| Source: | https://github.com/cran/corrRF |
Clustered random forest fitting
crf( formula, data, B = 500, L = 100, beta = 0.9, weight_optimiser = "Training MSE", correlation = "equicorr", maxdepth = 30, minbucket = 10, cp = 0, x0 = NULL, test_data = NULL, fixrho = FALSE, honesty = TRUE, verbose = TRUE, seed = NULL )crf( formula, data, B = 500, L = 100, beta = 0.9, weight_optimiser = "Training MSE", correlation = "equicorr", maxdepth = 30, minbucket = 10, cp = 0, x0 = NULL, test_data = NULL, fixrho = FALSE, honesty = TRUE, verbose = TRUE, seed = NULL )
formula |
an object of class 'formula' describing the model to fit. |
data |
training dataset for fitting the CRF. Note that group ID must be given by the column |
B |
the total number of trees (or trees per little bag if |
L |
the total number of little bags if providing a bootstrap of little bags estimate for inference. To not include set |
beta |
the subsampling rate. Default is |
weight_optimiser |
the method used to construct weights. Options are 'Pointwise variance', 'Training MSE' or 'Test MSE'. Default is 'Training MSE'. |
correlation |
the weight structure implemented. Currently supported options are 'ar1' and 'equicorr'. Default is 'equicorr'. |
maxdepth |
the maximum depth of the decision tree fitting. Default is 30. |
minbucket |
the minbucket of the decision tree fitting. Default is 10. |
cp |
the complexity paramter for decision tree fitting. Default is 0. |
x0 |
the covariate point to optimise weights towards if 'weightoptimiser' set to 'Pointwise variance'. |
test_data |
the test dataset to optimise weights towards if 'weightoptimiser' set to 'Test MSE'. |
fixrho |
fixes a pre-specified weight structure, given by the relevant 'ar1' or 'equicorr' parameter. Default is 'FALSE' (optimise weights). |
honesty |
whether honest or dishonest trees to be fit. Default is 'TRUE'. |
verbose |
Logical indicating whether or not to print computational progress. Default is 'TRUE'. |
seed |
Random seed for sampling. Default is NULL. |
A clustered random forest fitted object
Predictions from a fitted crf clustered random forest on newdata newdata.
## S3 method for class 'crf' predict(object, newdata, sderr = FALSE, ...)## S3 method for class 'crf' predict(object, newdata, sderr = FALSE, ...)
object |
a fitted |
newdata |
dataset on which predictions are to be performed. |
sderr |
whether 'bootstrap of little bags' standard errors should be additionally outputted. Default is |
... |
additional arguments |
Fitted values, potentially alongside standard errors (see sderr).
Summary of a fitted crf clustered random forest object fitted by crf.
## S3 method for class 'crf' summary(object, ...)## S3 method for class 'crf' summary(object, ...)
object |
a fitted |
... |
additional arguments |
Prints summary output for crf object