predict_funkyForest {funkycells} | R Documentation |
Predict a funkyForest
Description
This function gets the predicted value from a funkyForest model.
Usage
predict_funkyForest(model, data_pred, type = "all", data = NULL)
Arguments
model |
funkyForest model. See funkyForest. A list of CART models from rpart. Additionally this is given in funkyModel. |
data_pred |
data.frame of the data to be predicted. |
type |
(Optional) String indicating type of analysis. Options are pred or all. The choice changes the return to best fit intended use. |
data |
(Optional) Data.frame of full data. The data used to fit the model will be extracted (by row name). |
Value
The returned data depends on type:
type='pred': returns a vector of the predictions
type='all': returns a vector of the predictions
Examples
data_pp <- simulatePP(
agentVarData =
data.frame(
"outcome" = c(0, 1),
"A" = c(0, 0),
"B" = c(1 / 50, 1 / 50)
),
agentKappaData = data.frame(
"agent" = c("A", "B"),
"clusterAgent" = c(NA, "A"),
"kappa" = c(10, 5)
),
unitsPerOutcome = 5,
replicatesPerUnit = 1,
silent = FALSE
)
pcaData <- getKsPCAData(data_pp,
replicate = "replicate",
xRange = c(0, 1), yRange = c(0, 1), silent = FALSE
)
RF <- funkyForest(data = pcaData[-2], nTrees = 5) #
pred <- predict_funkyForest(
model = RF$model, type = "all",
data_pred = pcaData[-2],
data = pcaData[-2]
)
[Package funkycells version 1.1.1 Index]