Learn R Programming

metRology (version 0.9-28-1)

vr.mle: Vangel-Rukhin Maximum Likelihood Estimate

Description

Calculate a weighted mean, between-group standard deviation and standard error on the weighted mean using the Maximum likelihood algorithm of Vangel-Rukhin.

Usage

vr.mle(x, s2, n, init.mu = mean(x), init.sigma2 = var(x), labels = c(1:length(x)), 
       max.iter = 1000, tol = .Machine$double.eps^0.5, trace = FALSE)

# S3 method for summary.vr.mle print(x, ..., digits=3)

Arguments

x

numeric vector of the sample mean values of each group

s2

numeric vector of the sample variances of each group

n

integer vector of sample size of each group

init.mu

numeric initial value for the mean

init.sigma2

numeric initial value for the between-group component of variance

labels

vector of group names. Coerced to character on use.

max.iter

numeric maximum number of iterations

tol

numeric tolerance; iteration stops when the relative step size drops below 'tol'

trace

when TRUE shows the sequence of intermediate results

..., digits

Passed to format to control printed output.

Value

vr.mle returns an object of class "summary.vr.mle" which contains the following fields:

mu

the estimated mean

var.mu

the variance associated with the estimated mean

sigma2

the estimated between variance component

llh

the log likelihood of the estimates

tot.iter

the total number of iterations ran

cur.rel.abs.error

the current relative absolute error reached

gammai

a vector with the estimates of the weights

converged

TRUE is convergence criteria was met, FALSE otherwise

reduced.model

TRUE implies that a reduced model, with no between-group effect, is suggested, based on sigma2==0; FALSE indicates sigma2 > 0.

Details

The Vangel-Rukhin MLE algorithm finds the between-method variance by iteratively solving the equation relating the weighted mean to the weighting factor applied. The weighting factor is the inverse of the sum of the standard error in 'x' and the between-method variance, scaled by the between-method variance.

For the default method, 's2' is interpreted as a vector of sample variances. 'x' is interpreted as a vector of sample means and the algorithm is applied to the corresponding group means, variances, and sample sizes.

The Vangel-Rukhin MLE algorithm shows an improvement in the number of iterations required to converge over the classical MLE based on the Score equations.

The function mle.1wre implements the MLE for the one way random effects based on the Fisher scoring equations and is provided for comparison purpose only.

References

Vangel, M. G. and Rukhin, A. L. (1999), Biometrics, Vol 55, No. 1 pp 129-136

Searle, S. R., Cassella, G., and McCulloch, C. E. (1992). Variance Components. New York: Wiley.

See Also

mle.1wre, , loc.est-class

Examples

Run this code
# NOT RUN {
     ##===================================================================
     ## the dietary fiber in apples example in the Vangel and Rukhin paper
     ##===================================================================

     m1 <- c(12.46, 13.035, 12.44, 12.87, 13.42, 12.08, 13.18, 14.335, 12.23)
     s1 <- c(0.028, 0.233, 0.325, 0.071, 0.339, 0.325, 0.099, 0.064, 0.212)
     n1 <- c(2, 2, 2, 2, 2, 2, 2, 2, 2)

     res<- vr.mle(m1, s1^2, n1, tol=1e-6)

     res$mu
     sqrt(res$var.mu)
     res$sigma2
     res$mu+c(-1,1)*qnorm(0.975)*sqrt(res$var.mu)
     res$tot.iter
     res$converged
     res$reduced.model

     # output
     # 12.90585
     # 0.2234490
     # 0.4262122
     # 12.46790 13.34380
     # 6
     # converged = TRUE
     # reduced.model = FALSE
 
# }

Run the code above in your browser using DataLab