avg.plot {mvnimpute} | R Documentation |
Averaged simulated values plot function
Description
Calculates the average simulated values of all parameters and generates plots.
Usage
avg.plot(
data.mat,
start,
end,
x.lab = "Iteration number",
y.lab = "Average of simulated values",
title = NULL,
details = FALSE
)
Arguments
data.mat |
data matrix including the simulated values for plot. |
start |
the number of cycle to start. |
end |
the number of cycle to end. |
x.lab |
label of the x axis in the generated plot, default is set to "Iteration number". |
y.lab |
label of the y axis in the generated plot, default is set to "Average of simulated values". |
title |
title of each generated plot. |
details |
logical variable to specify whether the average simulated values are returned, default is set to FALSE. |
Details
This function calculates the average simulated values across simulations.
iter
can be any number of iterations you want to draw, the corresponding number of rows
of the data should be iter
+ 1.
Value
The plot of averaged values across iterations. If details
= TRUE,
a matrix containing the averaged values of all the variables across iterations will be returned.
Examples
### generate some normal data
dat <- MASS::mvrnorm(n = 1000, mu = c(1, 2, 3, 4), Sigma = diag(4))
### set column names
colnames(dat) <- paste0("Var ", 1:ncol(dat))
### average values plot: take sample from 500 to 1000 rows
avg.plot(data.mat = dat[500:1000, ], start = 500, end = 1000, title = "Random Variables")