evaluate_ssm {ssMousetrack} | R Documentation |
Evaluate the adequacy of the state-space model to reproduce the observed data
Description
Evaluate the adequacy of the state-space model to reproduce the observed data
Usage
evaluate_ssm(ssmfit = NULL, M = 100, plotx = TRUE)
Arguments
ssmfit |
(list) output of |
M |
(integer) number of replications |
plotx |
(boolean) if |
Details
The function implements a simulated-based method for assessing the adequacy of the model to reproduce the observed data. In particular,
the function provides two type of model adequacy, i.e. overall (PA_ov) and by-subject (PA_sbj). In the overall case the function provides the total amount of data reconstruction
based on the I x J x N matrix Y of observed data. By contrast, in the second case the function provides the adequacy of the model to reconstruct the individual-based set of data
as it works on the matrix J x N over i=1,...,I. Both the indices are in the range 0% - 100%, with 100% indicating perfect fit. In addition, the function returns a by-subject distance-based index (Dynamic Timw Warp distance) between observed and reproduced trajectories using dtw
function.
Value
a datalist containing the adequacy indices
Examples
## Not run:
## Fit a state-space model using simulated data
# Generate mouse-tracking data for an univariate experimental design with K = 3 categorical levels,
## J = 12 trials, I = 5 subjects
X1 <- generate_data(I=5,J=12,K=3,Z.formula="~Z1")
iid <- 23 # keep just one dataset from the simulated set of datasets
# Run the state-space model on the chosen dataset
X1_fit <- run_ssm(N = X1$N,I = X1$I,J = X1$J,Y = X1$data$Y[iid,,],D = X1$data$D[iid,,],
Z = X1$data$Z,niter=100,nwarmup=25)
# Evaluate the state-space model
evaluate_ssm(ssmfit = X1_fit,M = 10,plotx=FALSE)
## End(Not run)