R/wle.inversegaussian.lambda.R

Defines functions wle.inversegaussian.lambda.glm

#############################################################
#                                                           #
#	wle.inversegaussian.lambda.glm function             #
#	Author: Claudio Agostinelli                         #
#	E-mail: claudio@unive.it                            #
#	Date: April, 19, 2011                               #
#	Version: 0.1                                        #
#                                                           #
#	Copyright (C) 2011 Claudio Agostinelli              #
#                                                           #
#############################################################

wle.inversegaussian.lambda.glm <- function(y, mu, prior.weights=NULL, wle.weights=NULL) {
    if (is.null(prior.weights))
      prior.weights <- rep(1, length(y))
    if (is.null(wle.weights))
      wle.weights <- rep(1, length(y))
    w <- wle.weights*prior.weights
    lambda <- sum(w)/sum(w*((y-mu)^2)/(mu^2*y))
    dispersion <- 1/lambda
    res <- list(dispersion=dispersion, lambda=lambda)
    return(res)
}

Try the wle package in your browser

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

wle documentation built on May 29, 2017, 11:48 a.m.