Reusable information to convert an imputed dataset to fitting form

Share:

Description

Reusable information to convert an imputed dataset to fitting form

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
  imputeDs2FitDs(conversionData, ds, verbosity = 0, ...)

  ## Default S3 method:
imputeDs2FitDs(conversionData,ds,verbosity=0,...)

  ## S3 method for class 'dfrConversionProps'
imputeDs2FitDs(conversionData,ds,verbosity=0,...)

  ## S3 method for class 'dfrConversionPropsEx'
imputeDs2FitDs(conversionData,ds,verbosity=0,...)

  imputeDs2FitDsProps(object,ds,verbosity=0)

  ## Default S3 method:
imputeDs2FitDsProps(object,ds,verbosity=0)

  ## S3 method for class 'normalImputationConversion'
imputeDs2FitDsProps(object,ds,verbosity=0)

  removeScaling(object,verbosity=0)

  ## Default S3 method:
removeScaling(object,verbosity=0)

  ## S3 method for class 'dfrConversionPropsEx'
removeScaling(object,verbosity=0)

  normalImputationConversion(betweenColAndLevel = "",
    includeBaseLevel=FALSE, scalingParams=NULL,
    transformParams=NULL)

  typicalTransformations(nm="_AllNonFact", addGon=FALSE)

  typicalScaleAndCenter()

  newIllegals(f,x)

  isIllegal(x)

  removeIllegals(x)

  illegalsCountered(f, f2=constButWarnFunction(),
    f2OnAll=FALSE)

  illegalsCalculatedConstCountered(f, smry=min, dflt=1e-10)

  ## S3 method for class 'unsafefunction'
print(x,...)

  getUnsafeFunction(object)

  ## Default S3 method:
getUnsafeFunction(object)

  ## S3 method for class 'unsafefunction'
getUnsafeFunction(object)

  getSafeFunction(object,x)

  ## Default S3 method:
getSafeFunction(object,x)

  ## S3 method for class 'unsafefunction'
getSafeFunction(object,x)

  illegals2Null(f,x)

  constButWarnFunction(cnst=0, warn=TRUE)

  specialLegalX(f, x, smry=min, dflt=1e-10)

  illegalToSmryLegalFunction(f, smry=min, dflt=1e-10,
    warn=TRUE)

  interactionAdderAllNonSelf(fitcol, orgcoln)

Arguments

conversionData

object that holds information to convert an imputed dataset like dfrConversionProps or a custom implementation.

ds

dataset for which the lambdas need to be found

verbosity

The higher this value, the more levels of progress and debug information is displayed (note: in R for Windows, turn off buffered output)

...

For specific implementations

object

typically the return value of a call to imputeDs2FitDs

betweenColAndLevel

see dfrConversionProps

includeBaseLevel

see dfrConversionProps

scalingParams

list that may contain two items: "scale" and "center". Each are character vectors indicating which columns need to be scaled/centered. You can also use any of the meta-columns: "_AllNonFact", "_AllFact", "_All", "_AllExtra"

transformParams

list with an item per column that you want to apply transformations to (or you can use meta-column "_AllNonFact"). Each item is itself a list. The names are the extension that will be appended to the column name, the value is the function that will be applied to the column.

nm

name of the column or "_AllNonFact" (symbolically representing all non-factor columns) that these transformations will be applied to.

addGon

if TRUE, extra goniometrical transformations are added (sin, cos and tan)

f

function for which illegal results (NA or NaN) will be checked. You can also directly pass along the return values of some function

x

data for which the results of f will be checked

f2

function that is called for the items of x that give 'illegal' results

f2OnAll

if TRUE (not the default), f2 is reran on all items of x instead of only on the ones given illegal results from f

cnst

constant that will be repeated as return value (defaults to 0)

warn

if TRUE (default), each time this function is used, it will display a message

smry

summary function (like min, the default, or similar)

dflt

if the calculated summary still fails, this value is taken

fitcol

column names to be included in interactions

orgcoln

original coumns name (relevant for factors)

Details

'Illegal' means that the result became NA, NaN or infinite where x was none of those.

Value

dataset or matrix that can be used for fitting - depends on the implementation

In this implementation, log the fact + return the incoming dataset ds

In this implementation, use factorsToDummyVariables

In this implementation, use factorsToDummyVariables

Dataset to be used for fitting in EMLasso

In this (default) implementation, return whatever was passed in (object)

In this (default) implementation, creat a dfrConversionProps(Ex)

object that will still perform the other data conversions, but not scaling

In this (default) implementation, return whatever was passed in (object)

dfrConversionProps(Ex) object like object but without scaling

object of class normalImputationConversion

object that is ideally fit for use as parameter transformParams of normalImputationConversion

object that is ideally fit for use as parameter scalingParams of normalImputationConversion

logical vector of the same length as x. TRUE for elements of x that resulted in an 'illegal' return value of f

logical vector that holds TRUE for each 'illegal' element of x

copy of x where all the 'illegal' values have been removed

creates a list with two functions (safe and unsafe). The unsafe is simply f, the safe version calls f, but for items that become 'illegal', f2 is called. The class of the result is "unsafefunction"

The class of the result is "unsafefunction", but now has structure that wil allow to calculate the constant from the first set of x's passed along (see getSafeFunction)

nothing

function (a unsafe version of it - see illegalsCalculatedConstCountered or illegalsCountered)

In this implementation, simply return object

In this implementation, simply return object$unsafe

function (a safe version of it - see illegalsCalculatedConstCountered or illegalsCountered)

In this implementation, simply return object

In this implementation, simply return object$safe if it is present, or build one from the other properties

wrapper function around f that will return NULL if any of f(x) is turned into NA or NaN.

function that will return the right nr of repeats of the constant. Depending on the warn value, it will display a message that this occurred or not.

a single value that is either the calculated summary for the legal x and f(x) or dflt.

a function that is a wrapper around f which replaces illegal values with the return value for the summary value of the legal xs.

For interactionAdderAllNonSelf: a matrix with 2 rows. Each column holds a combination of 2 rowindexes that should be included as an interaction term.

Note

abstracts away creation of conversionData: see EMLasso

There is no reason to include ellipsis as a parameter! If you think you need it, look at the workaround through normalImputationConversion.

Warnings during the calling of f are suppressed

Warnings during the calling of f are suppressed

See Also

EMLasso

EMLasso factorsToDummyVariables

EMLasso factorsToDummyVariables

EMLasso

EMLasso

EMLasso

repeatedlyPredictOut

repeatedlyPredictOut

repeatedlyPredictOut

EMLasso

Examples

1
removeIllegals(c(1,NA,3,1/0,Inf))

Want to suggest features or report bugs for rdrr.io? Use the GitHub issue tracker.