Learn R Programming

ks (version 1.6.13)

pre.scale, pre.sphere: Pre-sphering and pre-scaling

Description

Pre-sphered or pre-scaled version of data.

Usage

pre.sphere(x, mean.centred=FALSE)
pre.scale(x, mean.centred=FALSE)

Arguments

x
matrix of data values
mean.centred
if TRUE then centre the data values to have zero mean

Value

  • Pre-sphered or pre-scaled version of data. These pre-transformations are required for implementing the plug-in Hpi selectors and the smoothed cross validation Hscv selectors.

Details

For pre-scaling, the data values are pre-multiplied by $\mathbf{S}^{-1/2}$ and for pre-scaling, by $(\mathbf{S}_D)^{-1/2}$ where $\mathbf{S}$ is the sample variance and $\mathbf{S}_D$ is $\mathrm{diag} \, (S_1^2, S_2^2, \dots, S_d^2)$ where $S_i^2$ is the i-th marginal sample variance.

If $\mathbf{H}^*$ is the bandwidth matrix for the pre-transformed data and $\mathbf{H}$ is the bandwidth matrix for the original data, then $\mathbf{H}=\mathbf{S}^{1/2} \mathbf{H}^* \mathbf{S}^{1/2}$ or $\mathbf{H} = \mathbf{S}_D^{1/2} \mathbf{H}^*\mathbf{S}_D^{1/2}$ as appropriate.

Examples

Run this code
data(unicef)
unicef <- as.matrix(unicef)
unicef.sp <- pre.sphere(unicef)
unicef.sc <- pre.scale(unicef, mean.centred=TRUE)
var(unicef.sp)
var(unicef.sc)

Run the code above in your browser using DataLab