This function performs checks to ensire that the user-supplied dropout function is correct.
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
Value
Nothing. Function only used for the sied effect of generating an error if the function is not correct.
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.
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.
See also
createDropout
calls this function before creating the
drop out flag.
Author
Mike K Smith mstoolkit@googlemail.com
Examples
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 )
if (FALSE) {
# wrong function
checkDropOutFun( max, testData )
# function that does not exist
checkDropOutFun( "XXXX", testData )
# function that does not exist
checkDropOutFun( XXXX, testData )
}