rsimsum 0.9.0

· 3 minutes read

It’s that time of the year: a new release of rsimsum just landed on CRAN. Changes are not as massive as in the previous release, but there is some important stuff going on nevertheless.

First, breaking changes! Who doesn’t like breaking changes? Anyone?

Here it comes: the control argument df has been renamed to power_df, and now affects power calculations only. That’s it.

This leads nicely into a new feature: you can pass a replication-specific number of degrees of freedom that will be used to calculate coverage probability using t critical values rather than normal theory. The t-test example can be once again used to illustrate that:

1
2
3
4
5
library(rsimsum)
data("tt", package = "rsimsum")

s <- simsum(data = tt, estvarname = "diff", se = "se", df = "df", true = -1)
summary(s, stats = "cover")
## Values are:
## 	Point Estimate (Monte Carlo Standard Error)
## 
## Coverage of nominal 95% confidence interval:
##         Estimate
##  0.9290 (0.0041)

Compare with the default:

1
2
s2 <- simsum(data = tt, estvarname = "diff", se = "se", true = -1)
summary(s2, stats = "cover")
## Values are:
## 	Point Estimate (Monte Carlo Standard Error)
## 
## Coverage of nominal 95% confidence interval:
##         Estimate
##  0.9233 (0.0042)

For reference, the new approach is equivalent to passing confidence limits (which in fact were calculated using t critical values):

1
2
s3 <- simsum(data = tt, estvarname = "diff", se = "se", ci.limits = c("lower", "upper"), true = -1)
summary(s3, stats = "cover")
## Values are:
## 	Point Estimate (Monte Carlo Standard Error)
## 
## Coverage of nominal 95% confidence interval:
##         Estimate
##  0.9290 (0.0041)

The next new feature is the addition of a kable method, which allows creating tables from summary (and non-summary) objects. Say you want a LaTeX table for your manuscript, with bias and coverage only:

1
kable(s, stats = c("bias", "cover"), format = "latex")
1
2
3
4
5
6
7
8
9
\begin{tabular}{l|r|r}
\hline
stat & est & mcse\\
\hline
bias & 0.0012 & 0.0256\\
\hline
cover & 0.9290 & 0.0041\\
\hline
\end{tabular}

Easy right? And of course, it supports all the power of kable (from the knitr package) and can export to other formats (such as HTML and plain markdown). The current implementation is very basic, with limited options; in the future, I am planning to add the possibility of automatically reshaping tables to ease comparisons.

Finally, some bugs and typos have been fixed since the latest release, and calculations for zip plots are noticeably faster that before.

That’s it for now: as always, you can install the updated version from CRAN by typing install.packages("rsimsum") in your R console (or using update.packages()).