A toy data set illustrating the spurious correlation between reading skills and shoe size in school-children.
A data frame with 200 observations on the following 4 variables.
a factor with levels
yesindicates that the child is a native speaker of the language of the reading test.
age of the child in years.
shoe size of the child in cm.
raw score on the reading test.
In this artificial data set, that was generated by means of a linear model,
nativeSpeaker are actual predictors of the
score, while the spurious correlation between
shoeSize is merely caused by the fact that both depend on
The true predictors can be identified, e.g., by means of partial correlations, standardized beta coefficients in linear models or the conditional random forest variable importance, but not by means of the standard random forest variable importance (see example).
1 2 3 4 5 6 7 8 9 10 11
set.seed(290875) readingSkills.cf <- cforest(score ~ ., data = readingSkills, control = cforest_unbiased(mtry = 2, ntree = 50)) # standard importance varimp(readingSkills.cf) # the same modulo random variation varimp(readingSkills.cf, pre1.0_0 = TRUE) # conditional importance, may take a while... varimp(readingSkills.cf, conditional = TRUE)
Want to suggest features or report bugs for rdrr.io? Use the GitHub issue tracker.