getSetOfSchemes: Generate a 'SetOfSchemes-class' object of speficified...

Description Usage Arguments Note Examples

View source: R/schemeGenerator.R

Description

Generate a SetOfSchemes-class object of speficified dimensions ( subjects, observations per t) for a given set of time points which meets user specified constraints

Usage

1
2
3
4
getSetOfSchemes(minNSubjects, maxNSubjects, minObsPerSubject,
  maxObsPerSubject, timePoints, constraints = NULL,
  maxRepetitionIndSchemes = 1, maxNumberOfSchemesBeforeChecks = 10^5,
  returnNSchemesBeforeConstraints = FALSE)

Arguments

minNSubjects

numeric, the mimimum number of subjects per scheme

maxNSubjects

numeric, the maximum number of subjects per scheme

minObsPerSubject

numeric, the mimimum number of sampling occasions per subject

maxObsPerSubject

numeric, the maximum number of sampling occasions per subject

timePoints

numeric vector of time points larger then zero, at which subject can be sampled

constraints

data.frame specifying constraints the scheme should meet. with columns:

  • check: identifier of the function to perform the check

  • level: the level at wich the check is applied: either at the subject level or scheme level

  • value: input value used by the check function

(a user can add constraint functions following naming convention check_[level]_[check] see examples: ( check_scheme_minObsPerTimePoint and check_subject_maxConsecSamples) ) remark: number of subjects per scheme or number of observations per scheme should not be specified in constraints

maxRepetitionIndSchemes

the maximum number of times an individual subject scheme can be repeated, defaults to 1

maxNumberOfSchemesBeforeChecks

the maximum number of schemes to consider before applying scheme constraints, to avoid to long processing and using up memory. defaults to 10^5

returnNSchemesBeforeConstraints

if TRUE return only number of schemes before checking constraints instead of the schemes themselves, defaults to FALSE

Note

keep number of subjects , range of number of subjects and observations per subject and number of timep points restricted to avoid a large number of potential schemes slowing down computation and increasing memory usage

only schemes with minimal one observation per subject are contained even if not specified in constraints

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
  timePoints          <-  c( 1.2 , 1.3 ,  2, 5  )
  constraints         <-  getConstraintsExample()
  ex1   <-  getSetOfSchemes( minNSubjects = 4 , maxNSubjects = 4 ,
    minObsPerSubject = 3 , maxObsPerSubject = 3 , timePoints , constraints )
  ex2   <-  getSetOfSchemes( minNSubjects = 4 , maxNSubjects = 4 ,
    minObsPerSubject = 3 , maxObsPerSubject = 3 , timePoints ,
    constraints ,  maxRepetitionIndSchemes = 1 )
  ex3   <-  getSetOfSchemes( minNSubjects = 4 , maxNSubjects = 4 , 
    minObsPerSubject = 2 , maxObsPerSubject = 3 , timePoints ,
    constraints , maxRepetitionIndSchemes = 1 )
  ex4   <-  getSetOfSchemes( minNSubjects = 2 , maxNSubjects = 5 ,
    minObsPerSubject = 2 , maxObsPerSubject = 3 , timePoints ,
    constraints , maxRepetitionIndSchemes = 1 )
  ex5   <-  getSetOfSchemes( minNSubjects = 2 , maxNSubjects = 5 ,
    minObsPerSubject = 2 , maxObsPerSubject = 3 , timePoints , 
    maxRepetitionIndSchemes = 2 )
  ## Not run: 
    # this should trow an error (to many combinations required )
    ex6   <-  getSetOfSchemes( minNSubjects = 2 , maxNSubjects = 5 , 
       minObsPerSubject = 2 ,  maxObsPerSubject = 3 , timePoints ,
       maxRepetitionIndSchemes = 2 ,  maxNumberOfSchemesBeforeChecks = 1000 )

## End(Not run)

microsamplingDesign documentation built on Oct. 13, 2021, 5:10 p.m.