misc: Utilities

miscR Documentation

Utilities

Description

Various helper functions.

Usage

replicMeans(nrep,toReplic,timing=FALSE)
stdErrPred(regObj,xnew)
pythonBlankSplit(s)
stopBrowser(msg = stop("msg not supplied"))
doPCA(x,pcaProp)
PCAwithFactors(x, nComps = ncol(x))
ulist(lst)
prToFile(filename)
partTrnTst(fullData,nTest=min(1000,round(0.2*nrow(fullData))))
findOverallLoss(regests,y,lossFtn = MAPE) 
getNamedArgs(argVec)
multCols(x,cols,vals)
probIncorrectClass(yhat, y, startAt1 = TRUE)
propMisclass(y,yhat)

Arguments

regests

Fitted regression estimates, training set.

y

Y values, training set.

yhat

Predicted Y values

startAt1

TRUE if indexing starts at 1, FALSE if starting at 0.

lossFtn

Loss functin.

fullData

A data frame or matrix.

nTest

Number of rows for the test set.

filename

Name of output file.

lst

An R list.

x

Matrix or data frame.

pcaProp

Fraction in [0,1], specifying number of PCA components to compute, in terms of fraction of total variance.

nComps

Number of PCA components.

regObj

An object of class 'lm' or similar, for which there is a vcov generic function.

xnew

New X value to be predicted.

nrep

Number of replications.

s

A character string.

toReplic

Function call(s), as a quoted string, separated by semicolons if more than one call.

timing

If TRUE, find average elapsed time over the replicates.

msg

Character string, error message for existing debug browser.

argVec

R list or vector with named elements.

cols

A set of column numbers.

vals

A set of positive expansion numbers.

Details

The function PCAwithFactors is a wrapper for stats::prcomp, to be used on data frames that contain at least on R factor.

Value

The function PCAwithFactors returns an object of class 'PCAwithFactors'. with components pcout, the object returned by the wrapped call to prcomp; factorsInfo, factor conversion information to be used with predict; and preds, the PCA version of x.

The function getNamedArgs will assign in the caller's space variables with the names and values in argVec.

Author(s)

Norm Matloff

Examples


w <- list(a=3,b=8)
getNamedArgs(w)  
a
b
u <- c(5,12,13)
names(u) <- c('x','y','z')
getNamedArgs(u)
x
y
z


regtools documentation built on March 31, 2022, 1:06 a.m.