Learn R Programming

vtreat (version 0.5.23)

designTreatmentsZ: Design variable treatments with no outcome variable.

Description

Data frame is assumed to have only atomic columns except for dates (which are converted to numeric). Note: each column is processed independently of all others.

Usage

designTreatmentsZ(dframe, varlist, ..., weights = c(), rareCount = 0,
  collarProb = 0, verbose = TRUE, parallelCluster = NULL)

Arguments

dframe
Data frame to learn treatments from (training data), must have at least 1 row.
varlist
Names of columns to treat (effective variables).
...
no additional arguments, declared to forced named binding of later arguments
weights
optional training weights for each row
rareCount
optional integer, suppress direct effects of level of this count or less.
collarProb
what fraction of the data (pseudo-probability) to collar data at (
verbose
if TRUE print progress.
parallelCluster
(optional) a cluster object created by package parallel or package snow

Value

  • treatment plan (for use with prepare)

Details

The main fields are mostly vectors with names (all with the same names in the same order):

- vars : (character array without names) names of variables (in same order as names on the other diagnostic vectors) - varMoves : logical TRUE if the variable varied during hold out scoring, only variables that move will be in the treated frame

See the vtreat vignette for a bit more detail and a worked example.

See Also

prepare designTreatmentsC designTreatmentsN

Examples

Run this code
dTrainZ <- data.frame(x=c('a','a','a','a','b','b',NA,'e','e'),
    z=c(1,2,3,4,5,6,7,NA,9))
dTestZ <- data.frame(x=c('a','x','c',NA),
    z=c(10,20,30,NA))
treatmentsZ = designTreatmentsZ(dTrainZ,colnames(dTrainZ),
  rareCount=0)
dTrainZTreated <- prepare(treatmentsZ,dTrainZ,pruneSig=1)
dTestZTreated <- prepare(treatmentsZ,dTestZ,pruneSig=1)

Run the code above in your browser using DataLab