[R] using loglog link in VGAM or creating loglog link for GLM

Mark Difford mark_difford at yahoo.co.uk
Sat Aug 22 20:29:13 CEST 2009


Hi Kendra,

>> 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).

If I were you I would look at ?zeroinfl in package pscl.

Regards, Mark.


Kendra Walker wrote:
> 
> 
> 
> 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
> 
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide
> http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
> 
> 

-- 
View this message in context: http://www.nabble.com/using-loglog-link-in-VGAM-or-creating-loglog-link-for-GLM-tp25091476p25096521.html
Sent from the R help mailing list archive at Nabble.com.




More information about the R-help mailing list