createParameters: Create parameter data for subjects in a simulated trial

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

View source: R/createParameters.R

Description

Creates parameter effects data for each subject in a simulated trial, either based on an external file or generated based on a multivariate normal distribution

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
createParameters(subjects, 
  genNames, 
  genFixedMean, 
  genFixedCov = 0, 
  genRange, 
  genBetweenNames, 
  genBetweenMean, 
  genBetweenCov, 
  genErrStruc = "None", 
  genMaxDraws = 10, 
  genParRangeTolerance = .5, 
  extFile, 
  extNames, 
  extBetween, 
  extBetweenNums, 
  extSubset, 
  extRange,
  extErrStruc = "None", 
  extRefCol, 
  extRefColName, 
  extRefColSuffix, 
  extIndEffects, 
  extDataId=idCol, 
  workingPath = getwd(), 
  suffix = ".Between", 
  idCol = getEctdColName("Subject"), 
  seed = .deriveFromMasterSeed(), 
  flagName = getEctdColName("ParOmit"))

Arguments

subjects

(Required) Vector of subjects (or number of subjects) for which to create parameters

genNames

(Optional) Names of fixed effects to generate. Default is missing

genFixedMean

(Optional) Means for generating fixed parameters. Default is missing

genFixedCov

(Optional) Covariance Matrix for generating fixed parameter. Default is a matrix of zeros

genRange

(Optional) Range of Acceptable values for derived fixed and random effects. Default is missing

genBetweenNames

(Optional) Names of between subjects effects to generate (must be a subset of the "genNames" input). Default is missing

genBetweenMean

(Optional) Means for generated between subject effects. Default is missing

genBetweenCov

(Optional) Between subject effect covariance matrix. Default is missing

genErrStruc

(Optional) Error structure for mapping generated fixed and between subject effects: Additive, Proportional, Log-Normal or None. Default is "None"

genMaxDraws

(Optional) Maximum number of draws to take when trying to generate values within a specified range. Default is 10

genParRangeTolerance

(Optional) Percentage of subjects with acceptable inputs for which we should continue

extFile

(Optional) Name of external file from which to import parameter data. Default is missing

extNames

(Optional) Names of parameters to import from the external data file. Default is missing

extBetween

(Optional) Between subject effect variables in the data. Default is missing

extBetweenNums

(Optional) Integer mapping between imported fixed and "between subject" effects. Default is missing

extSubset

(Optional) Subset to be applied to imported data before sampling. Default is missing

extRange

(Optional) Range of acceptable values for final external parameters

extErrStruc

(Optional) (None) Error structure for mapping imported fixed and between subject effects: Additive, Proportional, Log-Normal or None. Default is "None"

extRefCol

(Optional) Column of reference in imported data. Default is missing

extRefColName

(Optional) Reference column name in imported data. Default is missing

extRefColSuffix

(Optional) Reference column name suffix in imported data

extIndEffects

(Optional) Individual effects flag: do the external fixed effects represent individualised parameters. Default is missing

extDataId

(Optional) Subject variable name in external data file. Default is same as "idCol" input

workingPath

(Optional) Working directory from which to import external parameter data. By default, the current working directory is used

suffix

(Optional) Suffix to use for retained "between subject" effects. By default, ".Between" is used as the suffix

idCol

(Optional) Subject variable name ("SUBJ" by default)

seed

(Optional) Random number generate seed. By default, this is derived from the current random seed

flagName

(Optional) Name for "parameter omit" flag ("PAROMIT" by default)

Details

This function is a wrapper for 2 lower level functions: createNormalParameters and createExternalParameters The function passes the "gen" arguments to createNormalParameters and checks the return structure. It then passed the "ext" arguments to createExternalParameters and again checks the return structure. If only one of createNormalParameters or createExternalParameters are called, the single data structure is returned. If both createNormalParameters and createExternalParameters have been called, the inputs are combined into a single dataset for return.

Value

A data frame with a subject variable, a "parameter omit" flag and derived/imported parameter variables

Author(s)

Mike K Smith mstoolkit@googlemail.com

See Also

createNormalParameters and createExternalParameters

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
## Not run: 

# Generated parameters only
createParameters( subjects = 50, genNames = "X,Y,Z", genFixedMean = "0,0,0", genFixedCov = "1", 
  genBetweenNames = "X,Y,Z", genBetweenCov = "1", genBetweenMean = "0,0,0", genErrStruc = "a" )

# Imported parameters only
createParameters( subjects = 50, extNames = "E0,ED50,EMAX", extFile = "testParam.csv", 
  extErrStruc = "Additive", extBetween = "B1,B2", extBetweenNums = "1,3")

# Both generated and imported parameters
createParameters( subjects = 50, 
  extNames = "E0,ED50,EMAX", extFile = "testParam.csv", extErrStruc = "Additive", 
  extBetween = "B1,B2", extBetweenNums = "1,3", 
  genNames = "X,Y,Z", genFixedMean = "0,0,0", genFixedCov = "1", genBetweenNames = "X,Y,Z", 
  genBetweenCov = "1", genBetweenMean = "0,0,0", genErrStruc = "a" )
  

## End(Not run)

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