prepareData {cNORM} | R Documentation |
This is a convenience method to either load the inbuilt sample dataset, or to provide a data frame with the variables "raw" (for the raw scores) and "group" The function ranks the data within groups, computes norm values, powers of the norm scores and interactions. Afterwards, you can use these preprocessed data to determine the best fitting model.
prepareData( data = NULL, group = "group", raw = "raw", age = "group", k = 4, width = NA, weights = NULL, scale = "T", descend = FALSE, silent = FALSE )
data |
data.frame with a grouping variable named 'group' and a raw score variable named 'raw'. |
group |
grouping variable in the data, e. g. age groups, grades ... Setting group = FALSE deactivates modeling in dependence of age. Use this in case you do want conventional norm tables. |
raw |
the raw scores |
age |
the continuous explanatory variable; by default set to "group" |
k |
The power paramerer, default = 4 |
width |
if a width is provided, the function switches to rankBySlidingWindow to determine the observed raw scores, otherwise, ranking is done by group (default) |
weights |
Vector or variable name in the dataset with weights to compensate imbalances due to insufficient norm data stratification. All weights have to be numerical and positive. The code to compute weighted percentiles originates from the Hmisc package (functions) wtd.rank and wtd.table) and is provided by the courtesy of Frank Harrell. Please note, that this feature is currently EXPERIMENTAL! |
scale |
type of norm scale, either T (default), IQ, z or percentile (= no transformation); a double vector with the mean and standard deviation can as well, be provided f. e. c(10, 3) for Wechsler scale index point |
descend |
ranking order (default descent = FALSE): inverses the ranking order with higher raw scores getting lower norm scores; relevant for example when norming error scores, where lower scores mean higher performance |
silent |
set to TRUE to suppress messages |
data frame including the norm scores, powers and interactions of the norm score and grouping variable
Other prepare:
computePowers()
,
rankByGroup()
,
rankBySlidingWindow()
# conducts ranking and computation of powers and interactions with the 'elfe' dataset data.elfe <- prepareData(elfe) # use vectors instead of data frame data.elfe <- prepareData(raw=elfe$raw, group=elfe$group) # variable names can be specified as well, here with the BMI data included in the package data.bmi <- prepareData(CDC, group = "group", raw = "bmi", age = "age") # modeling with only one group with the 'elfe' dataset as an example # this results in conventional norming data.elfe2 <- prepareData(data = elfe, group = FALSE) m <- bestModel(data.elfe2)