[R] dglm()

K Y ky2009w @end|ng |rom y@hoo@com
Fri Dec 11 02:53:31 CET 2020


I used the double glm dglm() in R with "family=tweedie(var.power=p,link.power=0)", and need Chi-squared tests for the nested models of excluding each variable.

In order to do those tests,  I need the final working weights.

I was using the codes below to get the working weights from the deviance residuals, but I am not sure this is correct.  Also I wonder if there is a better way doing this.  Can anyone help?

y <- -(z$observed_target)^(2-p)

y <- y + (fitted(out))^(2-p)

y <- y / (2-p)

x <- (z$observed_target)^(2-p)

x <- x - z$observed_target * ((fitted(out))^(1-p))

x <- x / (1-p)



x <- 2 * (y + x)


y <- residuals(out, type = "deviance")

y <- y^2

y <- y / x #This should be the original weight mod by the modeled dispersion parameters or the final working weights.


	[[alternative HTML version deleted]]



More information about the R-help mailing list