Learn R Programming

tidyvpc (version 1.5.1)

predcorrect: Prediction corrected Visual Predictive Check (pcVPC)

Description

Specify prediction variable for pcVPC.

Usage

predcorrect(o, ...)

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

Value

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

Arguments

o

A tidyvpcobj.

...

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 logarithmic scale.

See Also

observed simulated censoring stratify binning binless vpcstats

Examples

Run this code
# \donttest{
require(magrittr)

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()
       # }

Run the code above in your browser using DataLab