Description Usage Arguments Details Value Note Author(s) See Also Examples

Generates diagnostic plots for assessing the convergence and autocorrelation behavior of `pan`

's and `jomo`

's MCMC algorithms.

1 2 3 4 |

`x` |
An object of class |

`print` |
A character vector containing one or several of |

`pos` |
Either |

`group` |
Either |

`trace` |
One of |

`thin` |
An integer denoting the thinning factor that is applied before plotting. Default is |

`smooth` |
A numeric value denoting the smoothing factor for the trend line in trace plots. Higher values correspond to less smoothing. Default is |

`n.Rhat` |
An integer denoting the number of segments of each chain used for calculating the potential scale reduction factor. Default is |

`export` |
(optional) A character string specifying if plots should be exported to a file. If |

`dev.args` |
(optional) A named list containing additional arguments that are passed to the graphics device. |

`...` |
Parameters passed to the plotting functions. |

The `plot`

method generates a series of plots for the parameters of the imputation model which can be used for diagnostic purposes.
In addition, a short summary of the parameter chain is displayed.

Setting `print`

to `"beta"`

, `"beta2"`

, `"psi"`

and `"sigma"`

will plot the fixed effects, the variances and covariances of the random effects, and the variances and covariances of the residuals, respectively.
In this context, `"beta2"`

refers to the fixed effects for target variables at level 2 and is only used when a two-part model was specified in (`jomoImpute`

).
Each plotting window contains a trace plot (upper left), an autocorrelation plot (lower left), a kernel density approximation of the posterior distribution (upper right), and a posterior summary (lower right).
The summary includes the following quantities:

`EAP`

:Expected value a posteriori (i.e., the mean of the parameter chain)

`MAP`

:Mode a posteriori (i.e., the mode of the parameter chain)

`SD`

:Standard deviation of the parameter chain

`2.5%`

:The 2.5% quantile of parameter values

`97.5%`

:The 97.5% quantile of parameter values

`Rhat`

:Estimated potential scale reduction factor (

*\hat{R}*)`ACF-k`

:Smoothed autocorrelation at lag

*k*, where*k*is the number of iterations between imputations (see`summary.mitml`

)

The `trace`

and `smooth`

arguments can be used to influence how the trace plot is drawn and what part of the chain should be used for it.
The `thin`

argument can be used for thinning the chain before plotting, in which case the number of data points is reduced in the trace plot, and the autocorrelation is calculated up to lag *k/thin* (see above).
The `n.Rhat`

argument controls the number of segments that are used for calculating the potential scale reduction factor (*\hat{R}*) in each plot (see `summary.mitml`

).
Further aguments to the graphics device are supplied using the `dev.args`

argument.

The `plot`

function computes and displays diagnostic information primarily for the imputation phase (i.e., for iterations after burn-in).
This is the default in the `plot`

function and the recommended method for most users.
If `trace = "all"`

, the full chain is displayed with emphasis on the imputation phase, and the posterior summary is calculated based on only the iterations after burn-in (as recommended).
If `trace = "burnin"`

, the posterior summary and the trace plots are calculated based on only the burn-on interations, which is generally not sufficient to establish convergence and should be used with caution.

None (invisible `NULL`

).

The plots are presented on-screen one at a time. To proceed with the next plot, the user may left-click in the plotting window or press the "enter" key while in the R console, depending on the operating system. No plots are displayed when exporting to file.

Simon Grund

`panImpute`

, `jomoImpute`

, `summary.mitml`

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 29 30 | ```
## Not run:
data(studentratings)
# * Example 1: simple imputation
fml <- ReadDis + SES ~ ReadAchiev + (1|ID)
imp <- panImpute(studentratings, formula = fml, n.burn = 1000, n.iter = 100, m = 5)
# plot all parameters (default)
plot(imp)
# plot fixed effects only
plot(imp, print = "beta")
# export plots to file (using pdf device)
plot(imp, export = "pdf", dev.args = list(width = 9, height = 4, pointsize = 12))
# * Example 2: groupwise imputation
fml <- ReadDis + SES ~ ReadAchiev + (1|ID)
imp <- panImpute(studentratings, formula = fml, group = FedState, n.burn = 1000,
n.iter = 100, m = 5)
# plot fixed effects for all groups (default for 'group')
plot(imp, print = "beta", group = "all")
# plot fixed effects for first group only
plot(imp, print = "beta", group = 1)
## End(Not run)
``` |

Embedding an R snippet on your website

Add the following code to your website.

For more information on customizing the embed code, read Embedding Snippets.