This function computes the "spread score" for a sample of data, given a ctree explaining a binary variable. New data samples are "predicted" into their ctree nodes and the probability of a 'True' response value for their members is fed into a weighted average of the absolute distance from the sample mean across all dat asamples. The higher the score, the better the model has done at classifying people with divergent behaviors (higher or loewr than average).
1 | spreadScore(df, df.ct, nSample = NULL, responseVar, ignoreCols = c())
|
df |
data.frame with response variable to be explained and all explanatory variables to be used in ctree classificaiton |
df.ct |
ctree already trained on data, that is used to classify the data points in each sub sample. |
nSample |
number of samples (with replacement) to use for the calculation |
responseVar |
the name of the variable that the ctree is trying to explain |
ignoreCols |
an optional list of columns in df, but that should be excluded from the ctree modeling |
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.