predcorrect: predcorrect

Description Usage Arguments Details Value See Also Examples

Description

Prediction corrected Visual Predictive Check (pcVPC)

Usage

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

## S3 method for class 'tidyvpcobj'
predcorrect(o, pred, data = o$data, ..., log = FALSE)

Arguments

o

tidyvpc object

...

Other arguments to include

pred

prediction variable in observed data

data

observed data supplied in observed() function

log

logical indicating whether DV was modeled in logarithimic scale

Details

Specify prediction variable for pcVPC

Value

Updates tidyvpcobj with required information to performing prediction correction which include predcor logical indicating whether prediction corrected VPC is to be performed, predcor.log logical indicating whether the DV is on a log-scale, and the pred prediction column from the original data.

See Also

observed simulated censoring stratify 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
22
23
24
25
26
27
28
obs_data <- data.table::as.data.table(tidyvpc::obs_data)
sim_data <- data.table::as.data.table(tidyvpc::sim_data)

obs_data <- obs_data[MDV == 0]
sim_data <- sim_data[MDV == 0]

 # Add PRED variable to observed data from first replicate of 
 # simulated data
 
obs_data$PRED <- sim_data[REP == 1, PRED]

  vpc <- observed(obs_data, x=TIME, y=DV) %>%
       simulated(sim_data, y=DV) %>%
       binning(bin = NTIME) %>%
       predcorrect(pred=PRED) %>%
       vpcstats()
       
     
 # For binless loess prediction corrected, use predcorrect() before 
 # binless() and set loess.ypc = TRUE
 
  vpc <- observed(obs_data, x=TIME, y=DV) %>%
       simulated(sim_data, y=DV) %>%
       predcorrect(pred=PRED) %>%
       binless(loess.ypc = TRUE) %>%
       vpcstats()
       
       

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