Learn R Programming

microsamplingDesign (version 1.0.8)

rankObject: generic function to calulate a ranking-slot

Description

generic function to calulate a ranking-slot

Usage

rankObject(object, ...)

fastRankSchemes(object, pkData, objective, nCores = 1)

# S4 method for SetOfSchemes rankObject(object, pkData, objective, varianceMeasure = "var", scaleWith = "max", skipTests = FALSE, nCores = 1)

# S4 method for SetOfTimePoints rankObject(object, pkData, nGrid = 100, nSamplesAvCurve = 1000, useAverageRat = FALSE, avCurve = NULL, nCores = 1)

Arguments

object

a S4 class object

...

additional parameters

objective

a data.frame with columns:

  • criterion summary function of an estimeted pkCurve (data frame with columns time and concentration): area under the curve (auc) ; maximum concentration (cMax) and time when the maximum concentration is reached (tMax); user defined functions are alowed but prefix pkCurveStat_ should be added in function definition, see examples pkCurveStat

  • weight relative importance of the different criteria

nCores

number of cores used in parellel processing, defaults to 1

varianceMeasure

variance criteria applied to the objective, defaults to summarise objective over sample data, defaults to var

scaleWith

function to scale different criteria in objective before combining results by taking a weighted sum

skipTests

if TRUE object validity and compatibility is not tested, defaults to FALSE , doing these tests is slow

nGrid

number of equally spaced point to calculate the distance between sample and population averaged kinetic curve, defaults to 100

nSamplesAvCurve

the number of samples to calculate the averaged curve ( only to rank SetOfTimePoints-class), defaults to 1000

useAverageRat

logical value if TRUE, the average rat (with random effects equal to zero and no additional error) is used instead of the integrated out population averaged curve, defaults to FALSE; this is faster but biased

avCurve

a user specified averaged curve, when specified, the average curve is no longer calculated from the pkModel, defaults to NULL

Value

SetOfSchemes-class object

Details

fastRankSchemes is a faster version to rankSetOfSchemes-class objects , with fixed settings ( objective AUC and cMax , summary measure is variance and scale measure is maximum ). It is meant to be used inside the shiny application

Examples

Run this code
# NOT RUN {
  setOfSchemes             <-  getExampleSetOfSchemes()
  dataForSchemes            <-  getExampleData()
  ex1       <-  rankObject( object = setOfSchemes, dataForSchemes ,
    objective = data.frame( criterion = "auc" , weight = 1 ) )
  getRanking(ex1) # to get the dataframe and not the whole object
  ex2       <-  rankObject( object = setOfSchemes, dataForSchemes ,
    objective = data.frame( criterion = "auc" , weight = 1 )  ,
    varianceMeasure = "sd" , scaleWith = "min" ) 
  getRanking(ex2) 
  ex3       <-  rankObject( object = setOfSchemes, dataForSchemes ,
    objective = data.frame( criterion = c( "auc" , "cMax" , "tMax" )  ,
     weight = c( 9 , 1, 1 ) ) ) 
  getRanking(ex3)

  # example with own defined varianceMeasure
  rangeWidth     <-  function( x ){
     range <-  range(x) ;
     rangeWith  <-  range[2] - range[1]; rangeWith
   }
  ex4       <-  rankObject( object = setOfSchemes, dataForSchemes , 
      objective = data.frame( criterion = c( "auc" , "cMax" , "tMax" )  , 
      weight = c( 9 , 1, 1 ) ) ,
      varianceMeasure = "rangeWidth" ,
      scaleWith = "mean" ) 
# }
# NOT RUN {
 fullTimePoints    <-  0:10
 setOfTimePoints   <-  getExampleSetOfTimePoints( fullTimePoints)
 pkDataExample     <-  getPkData( getExamplePkModel() , getTimePoints( setOfTimePoints ) , 
   nSubjectsPerScheme = 5 , nSamples = 17   )
 ex1               <-  rankObject( object = setOfTimePoints , pkData = pkDataExample ,
     nGrid = 75 , nSamplesAvCurve = 13)
 ex2               <-  rankObject( object = setOfTimePoints ,   pkData = pkDataExample , 
     nGrid = 75 , nSamplesAvCurve = 13 , useAverageRat = TRUE )
 ex3               <-  rankObject( object = setOfTimePoints ,   pkData = pkDataExample ,
     nGrid = 75 , avCurve = rep(0 , length(fullTimePoints) ) )
# }

Run the code above in your browser using DataLab