| aug_t | R Documentation |
Calculates a t-interval using augmented data c(x,A). The multiplier
of this interval bounds the level above level, so these intervals
are typically conservative. This method is very fast for n <= 100
and level %in% c(0.8, 0.9, 0.95, 0.99) because I saved those
multipliers in an internal dataset. But it can be slow (on the order of
a second) for other confidence levels or larger sample sizes.
aug_t(x, A = 0, level = 0.95, wt = 1)
x |
The vector of data |
A |
The prior mean |
level |
The level of the interval |
wt |
Weight for A. Don't touch this unless you know what you are doing. |
Suppose X_1,\ldots,X_n \sim N(\mu,\sigma^2). Suppose we have
prior value A. This provides intervals of the form
\hat{\mu} \pm \eta \hat{\sigma}/\sqrt{n + 1},
where \hat{\mu} and \hat{\sigma} are the sample mean and
sample standard deviation of the augmented data X_1,\ldots,X_n,A,
and \eta is chosen large enough to maintain the confidence level
at all parameter values.
The wt argument allows for more copies of A
to be included in the data augmentation. But it doesn't work well with
more data augmentation so you should not set it above 1. Though, you can set
wt to be between 0 and 1 (to have less data augmentation) and this
does seem to work pretty well, but I haven't studied it extensively,
so use at your own risk.
Note that you have to choose A before seeing the data. If you choose
it based on the data, then you no longer maintain the confidence level.
The augmented t-interval of the specified level.
David Gerard
set.seed(1)
## A is exactly correct
x <- rnorm(10)
aug_t(x)
stats::t.test(x)$conf.int
## A is very wrong
x <- rnorm(10)
aug_t(x, A = 100)
stats::t.test(x)$conf.int
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.