Computes predicted cumulative history using posterior predictive distribution.
Source:R/predict_history.R
predict_history.Rd
Computes predicted cumulative history using fitted model. This is just a wrapper
for predict(object, summary, probs, full_length, predict_history=history_type)
.
Usage
predict_history(
object,
history_type,
summary = TRUE,
probs = NULL,
full_length = TRUE,
...
)
Arguments
- object
An object of class cumhist
- history_type
"1"
or"2"
for cumulative history for the first or second perceptual states (with indexes 1 and 2, respectively),"dominant"
or"suppressed"
for cumulative history for states that either dominant or suppressed during the following phase,"difference"
for difference between suppressed and dominant. See cumulative history vignette for details.- summary
Whether summary statistics should be returned instead of raw sample values. Defaults to
TRUE
- probs
The percentiles used to compute summary, defaults to NULL (no CI).
- full_length
Only for
summary = TRUE
, whether the summary table should include rows with no predictions. I.e., rows with mixed phases, first/last dominance phase in the run, etc. Seepreprocess_data()
. Defaults toTRUE
.- ...
Unused
Value
If summary=FALSE
, a numeric matrix iterationsN x clearN.
If summary=TRUE
but probs=NULL
a vector of requested cumulative history values.
If summary=TRUE
and probs
is not NULL
, a data.frame
with a column "Predicted" (mean) and a column for each specified quantile.
Examples
# \donttest{
br_fit <- fit_cumhist(br_singleblock, state = "State", duration = "Duration")
#>
#> SAMPLING FOR MODEL 'historylm' NOW (CHAIN 1).
#> Chain 1:
#> Chain 1: Gradient evaluation took 0 seconds
#> Chain 1: 1000 transitions using 10 leapfrog steps per transition would take 0 seconds.
#> Chain 1: Adjust your expectations accordingly!
#> Chain 1:
#> Chain 1:
#> Chain 1: Iteration: 1 / 2000 [ 0%] (Warmup)
#> Chain 1: Iteration: 200 / 2000 [ 10%] (Warmup)
#> Chain 1: Iteration: 400 / 2000 [ 20%] (Warmup)
#> Chain 1: Iteration: 600 / 2000 [ 30%] (Warmup)
#> Chain 1: Iteration: 800 / 2000 [ 40%] (Warmup)
#> Chain 1: Iteration: 1000 / 2000 [ 50%] (Warmup)
#> Chain 1: Iteration: 1001 / 2000 [ 50%] (Sampling)
#> Chain 1: Iteration: 1200 / 2000 [ 60%] (Sampling)
#> Chain 1: Iteration: 1400 / 2000 [ 70%] (Sampling)
#> Chain 1: Iteration: 1600 / 2000 [ 80%] (Sampling)
#> Chain 1: Iteration: 1800 / 2000 [ 90%] (Sampling)
#> Chain 1: Iteration: 2000 / 2000 [100%] (Sampling)
#> Chain 1:
#> Chain 1: Elapsed Time: 4.338 seconds (Warm-up)
#> Chain 1: 4.486 seconds (Sampling)
#> Chain 1: 8.824 seconds (Total)
#> Chain 1:
history_difference_summary <- predict_history(br_fit, "difference")
# full posterior prediction samples
history_difference <- predict_history(br_fit,
"difference",
summary = FALSE,
full_length = TRUE)
# }