Learn R Programming

mbrdr (version 1.1.1)

choose.fx: choose fx for principal fitted response reduction and unstructured principal fitted response reduction

Description

Returns a \(n \times q\) matrix used in principal fitted response reduction and unstructured principal fitted response reduction.

Usage

choose.fx(X, fx.choice=1, nclust = 5)

Arguments

X

\(n \times p\) predictor matrix

fx.choice

four choices for fx; see below

nclust

the number of clusters; see below

Value

A \(n \times q\) matrix for fx.

Details

Both of principal fitted response reduction and unstructured principal fitted response reduction require a choice of fx. The function will return one of four choices of fx, which are popular candidates among many.

fx.choice=1: This is default and returns the original predictor matrice X, centered at zero as fx.

fx.choice=2: This returns the original predictor matrice X, centered at zero and its squared values.

fx.choice=3: This returns the original predictor matrice X, centered at zero and its exponentiated values.

fx.choice=4: This clusters X with K-means algoritm with the number of clusters equal to the value in nclust. Then, the cluster results are expanded to \(\code{nclust}-1\) dummy variables, like factor used in lm function. Finally, it returns nclust-1 categorical basis. The option of nclust works only with fx.choice=4.

Examples

Run this code
# NOT RUN {
data(mps)
X <- mps[,c(5:6,8:14)]
choose.fx(X)

choose.fx(X, fx.choice=2)

choose.fx(X, fx.choice=4, nclust=3)
# }

Run the code above in your browser using DataLab