computePowers: Compute powers of the explanatory variable a as well as of...

View source: R/preparation.R

computePowersR Documentation

Compute powers of the explanatory variable a as well as of the person location l (data preparation)

Description

The function computes powers of the norm variable e. g. T scores (location, L), an explanatory variable, e. g. age or grade of a data frame (age, A) and the interactions of both (L X A). The k variable indicates the degree up to which powers and interactions are build. These predictors can be used later on in the bestModel function to model the norm sample. Higher values of k allow for modeling the norm sample closer, but might lead to over-fit. In general k = 3 or k = 4 (default) is sufficient to model human performance data. For example, k = 2 results in the variables L1, L2, A1, A2, and their interactions L1A1, L2A1, L1A2 and L2A2 (but k = 2 is usually not sufficient for the modeling). Please note, that you do not need to use a normal rank transformed scale like T or IQ; you can use the percentiles for the 'normValue' as well.

Usage

computePowers(data, k = 5, norm = NULL, age = NULL, t = 3, silent = FALSE)

Arguments

data

data.frame with the norm data

k

degree of the location polynomial (1..6)

norm

name of the norm variable in the data.frame (T scores, IQ, percentiles, ...). If 'NULL', the '"normValue"' attribute of 'data' is used.

age

explanatory variable (e.g. age or grade). May be a column name, a numeric vector of 'nrow(data)', 'FALSE' to disable age handling, or 'NULL' to fall back to the '"age"' attribute of 'data'.

t

age power parameter (1..6). If 'NULL', falls back to 'k'.

silent

set to TRUE to suppress messages

Details

The functions rankBySlidingWindow, rankByGroup, bestModel, computePowers and prepareData are usually not called directly, but accessed through other functions like cnorm.

Value

data.frame with the powers and interactions of location and explanatory variable / age

See Also

bestModel

Other prepare: prepareData(), rankByGroup(), rankBySlidingWindow()

Examples

## Not run: 
# Dataset with grade levels as grouping
data.elfe <- rankByGroup(elfe)
data.elfe <- computePowers(data.elfe)

# Dataset with continuous age variable and k = 5
data.ppvt <- rankByGroup(ppvt)
data.ppvt <- computePowers(data.ppvt, age = "age", k = 5)

## End(Not run)

cNORM documentation built on July 13, 2026, 5:08 p.m.