checkDropOutFun: check the user supplied drop out function

Description Usage Arguments Details Value Note Author(s) See Also Examples

Description

This function performs checks to ensire that the user-supplied dropout function is correct.

Usage

1
checkDropOutFun(fun, data, sizeSubset = 5, useSubset= TRUE, ...)

Arguments

fun

(Required) Function to check for validity

data

(Required) Dataset to use for performing the valildity check

sizeSubset

(Optional) Number of "initial" rows from the provided data to use in the test for the validity of the function. The default is "5"

useSubset

(Optional) Should the check operate on a subset of the data, as opposed to the entire dataset? TRUE by default

...

(Optional) Extra arguments to be passed directly to the function being tested. No extra arguments are passed by default

Details

A correct dropout function must have at least a data argument, and it must return a numeric vector containing the values 0 and 1 having as its length the number of rows of the dataset it is given.

Value

Nothing. Function only used for the sied effect of generating an error if the function is not correct.

Note

if useSubset is set to TRUE, only a subset of the data is used to perform the check. The size of the subset is then the minimum of the sizeSubset and the number of rows in the dataset.

Author(s)

Mike K Smith mstoolkit@googlemail.com

See Also

createDropout calls this function before creating the drop out flag.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
  dFun <- function(data, prop) sample(0:1, nrow(data), TRUE, c(1-prop, prop))
   testData <- data.frame(
     SUBJ=rep(1:10, each=5), 
     TIME=rep(0:4, 10), 
     VALUE=rnorm(50))
  checkDropOutFun( dFun, testData, prop = .2 )
  
  ## Not run: 
    # wrong function
    checkDropOutFun( max, testData )
    
    # function that does not exist
    checkDropOutFun( "XXXX", testData )
    
    # function that does not exist
    checkDropOutFun( XXXX, testData )
    
  
## End(Not run)

MSToolkit documentation built on May 2, 2019, 6:30 p.m.