% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/preparation.R
\name{computePowers}
\alias{computePowers}
\title{Compute powers of the explanatory variable a as well as of the person
location l (data preparation)}
\usage{
computePowers(data, k = 5, norm = NULL, age = NULL, t = 3, silent = FALSE)
}
\arguments{
\item{data}{data.frame with the norm data}

\item{k}{degree of the location polynomial (1..6)}

\item{norm}{name of the norm variable in the data.frame (T scores, IQ, percentiles, ...).
If `NULL`, the `"normValue"` attribute of `data` is used.}

\item{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`.}

\item{t}{age power parameter (1..6). If `NULL`, falls back to `k`.}

\item{silent}{set to TRUE to suppress messages}
}
\value{
data.frame with the powers and interactions of location and explanatory
  variable / age
}
\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
\code{\link{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.
}
\details{
The functions \code{rankBySlidingWindow}, \code{rankByGroup}, \code{bestModel},
\code{computePowers} and \code{prepareData} are usually not called directly, but accessed
through other functions like \code{cnorm}.
}
\examples{
\dontrun{
# 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)
}
}
\seealso{
bestModel

Other prepare:
\code{\link[=prepareData]{prepareData()}},
\code{\link[=rankByGroup]{rankByGroup()}},
\code{\link[=rankBySlidingWindow]{rankBySlidingWindow()}}
}
\concept{prepare}
