censoring: censoring

Description Usage Arguments Details Value See Also Examples

View source: R/vpcstats.R

Description

Censoring observed data for Visual Predictive Check (VPC)

Usage

1
2
3
4
censoring(o, ...)

## S3 method for class 'tidyvpcobj'
censoring(o, blq, lloq, alq, uloq, data = o$data, ...)

Arguments

o

tidyvpc object

...

Other arguments to include

blq

blq variable if present in observed data

lloq

lloq variable if present in observed data. Use numeric to specify lloq value

alq

logical variable indicating above limit of quantification

uloq

number or numeric variable in data indicating the upper limit of quantification

data

observed data supplied in observed() function

Details

Specify censoring variables or censoring value for VPC using this function

Value

Updates obs data.frame in tidypcobj with censored values for observed data which includes lloq and uloq specified values for lower/upper limit of quantification. Logicals for blq and alq are returned which indicate whether the DV value lies below/above limit of quantification.

See Also

observed simulated stratify predcorrect binning binless vpcstats

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
obs_data <- as.data.table(tidyvpc::obs_data)
sim_data <- as.data.table(tidyvpc::sim_data)

vpc <- observed(obs_data, x=TIME, y=DV) %>%
    simulated(sim_data, y=DV) %>%
    censoring(blq=(DV < 50), lloq=50) %>%
    binning(bin = "pam", nbins = 5) %>%
    vpcstats()

#Using LLOQ variable in data with different values of LLOQ by Study:

obs_data$LLOQ <- obs_data[, ifelse(STUDY == "Study A", 50, 25)]

vpc <- observed(obs_data, x=TIME, y=DV) %>%
    simulated(sim_data, y=DV) %>%
    censoring(blq=(DV < LLOQ), lloq=LLOQ) %>%
    stratify(~ STUDY) %>%
    binning(bin = "kmeans", nbins = 4) %>%
    vpcstats()

 

Example output

Loading required package: data.table
Loading required package: magrittr
Loading required package: quantreg
Loading required package: SparseM

Attaching package:SparseMThe following object is masked frompackage:base:

    backsolve

tidyvpc documentation built on Jan. 13, 2021, 6:31 a.m.