R/lndest.R

Defines functions lndest

Documented in lndest

lndest <-
function(x, f)
{
    f <- as.factor(f)
    nx <- tapply(x, f, length)
    lx <- log(x)
    mlx <- tapply(lx,f,mean)
    varlx <- tapply(lx,f,var)*((nx-1)/nx)
    mx <- exp(mlx + 0.5 * varlx)
    varmx <- (mx^2)*varlx/nx + (mx^2)*(varlx^2)/(2*nx)
return(list(estimate=mx, varest=varmx, n=nx))}

Try the MCPAN package in your browser

Any scripts or data that you put into this service are public.

MCPAN documentation built on May 1, 2019, 8:04 p.m.