View source: R/squeezeVarRob.R
squeezeVarRob | R Documentation |
This function squeezes a set of sample variances together by computing empirical Bayes posterior means in a way that is robust against the presence of very small non-integer degrees of freedom values.
squeezeVarRob(
var,
df,
covariate = NULL,
robust = FALSE,
winsor.tail.p = c(0.05, 0.1),
min_df = 1
)
var |
A numeric vector of independent sample variances. |
df |
A numeric vector of degrees of freedom for the sample variances. |
covariate |
If |
robust |
A logical indicating wheter the estimation of |
winsor.tail.p |
A numeric vector of length 1 or 2, giving left and right tail proportions of |
min_df |
A numeric value indicating the minimal degrees of freedom that will be taken into account for calculating the prior degrees of freedom and prior variance. |
k |
A numeric value indicating that the calculation of the robust squeezed variances should Winsorize at |
A list with components:
var.post
A numeric vector of posterior variances.
var.prior
The location of prior distribution. A vector if covariate
is non-NULL
, otherwise a scalar.
df.prior
The degrees of freedom of prior distribution. A vector if robust=TRUE
, otherwise a scalar.
var <- rexp(1000)
df <- sample( 3:10, 1000, replace = TRUE)
tmp <- squeezeVarRob(var, df)
tmp <- squeezeVarRob(var, df, robust = TRUE)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.