[R] using loglog link in VGAM or creating loglog link for GLM
Kendra Walker
klwalker at umich.edu
Sat Aug 22 00:27:04 CEST 2009
I am trying to figure out how to apply a loglog link to a binomial
model (dichotomous response variable with far more zeros than ones).
I am aware that there are several relevant posts on this list, but I
am afraid I need a little more help. The two suggested approaches
seem to be: 1) modify the make.link function in GLM, or 2) use the
loglog or cloglog functions in the VGAM package. Below are my
questions for each. Responses to either are much appreciated.
1) Modifying the make.link function:
In his Sat, 24 Jan 2009 post, Re: [R] glm binomial loglog (NOT
cloglog) link, William Simpson suggested a loglog={} insertion that
seems reasonable. Being new to R, however, I am going in circles
trying to figure out make this seemingly simple modification to the
code. If anyone has the patience to step me through the process, or
refer me to the relevant information, I would be very grateful.
2) Using the loglog function in VGAM:
I tried fitting the model: m<- vglm(Y~X,
family=binomialff(link="loglog"), data = d) but I get the following
error? Error in lm.fit(X_vlm, z_vlm, ...) : NA/NaN/Inf in foreign
function call (arg 4) In addition: Warning message:In log(log(theta))
: NaNs produced?.
If I run the same model using cloglog as the link, I get a result that
looks like the result I get using cloglog in GLM. This is a bad fit
for my data, however, as I have many more zeros than ones. The help
document for loglog states that NaNs are produced when theta is close
to 1 unless earg is used. I am confused as to how to properly use the
earg parameter (and why I do not need it for cloglog despite having
many zeros), leading me to wonder whether the loglog link here is
really what I think it is (the compliment of cloglog). Again, any
insights as to what I am missing would be appreciated.
Many thanks,
Kendra Walker,
School of Natural Resources and the Environment,
University of Michigan
More information about the R-help
mailing list