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
)
A numeric vector of independent sample variances.
A numeric vector of degrees of freedom for the sample variances.
If non-NULL
, var.prior
will depend on this numeric covariate. Otherwise, var.prior
is constant.
A logical indicating wheter the estimation of df.prior
and var.prior
should be robustified against outlier sample variances. Defaults to FALSE
.
A numeric vector of length 1 or 2, giving left and right tail proportions of x
to Winsorize. Used only when robust=TRUE
.
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.
A numeric value indicating that the calculation of the robust squeezed variances should Winsorize at k
standard deviations.
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.