OneComp: INTERNAL FUNCTION: Extract a single component from...

View source: R/ImputeRegressionMulti.R

OneCompR Documentation

INTERNAL FUNCTION: Extract a single component from multivariate data

Description

Rows with any missing elements give corresponding missing values in output.

Usage

OneComp(
  data,
  variables = 1:dim(data)[2],
  method = c("mean", "pca", "pcaMedian", "pcaStd")
)

Arguments

data

Data frame or matrix containing the variables

variables

Indices of variables to extract component from

method

Method coded as a string: "mean" (default),"pca","pcaMedian" or "pcaStd" where: "mean" means rowMeans. "pcaMedian" means pca/svd on data scaled by median of absolute values. "pcaStd" means pca/svd on data centered and scaled by st.dev.

Value

A single component is retuned as a vector. This component is scaled to be a weighted row-sum of input so that sum(abs(weights))=1.

Examples

 OneComp(matrix(rnorm(15),5,3),method="pca")

statisticsnorway/Kostra documentation built on Sept. 25, 2024, 10:37 a.m.