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

2011-01-24 Thread Gavin Simpson
On Sun, 2011-01-23 at 10:56 -0800, torbjore wrote:
 I think you guys make it more difficult than it has to be. Estimating
 probability of success with a loglog-link is equivalent to estimating
 probability of failure with a cloglog-link, so all you have to do is to
 change the response variable accordingly (and then you can interpret
 parameter estimates (or any contrasts in general) as hazard ratios)...

Err, isn't that **exactly** what I said?! (May be the you guys wasn't
aimed at me but there were only two responses in that thread, one of
them from me... and you haven't quoted to what it was you were
referring.)

 Though, I wish there was a loglog-link in glm and lmer so you wouldn't have
 to do this.

You are, in effect, asking other people to maintain more code for you
when you can easily alter the coding for the response.

G
-- 
%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%
 Dr. Gavin Simpson [t] +44 (0)20 7679 0522
 ECRC, UCL Geography,  [f] +44 (0)20 7679 0565
 Pearson Building, [e] gavin.simpsonATNOSPAMucl.ac.uk
 Gower Street, London  [w] http://www.ucl.ac.uk/~ucfagls/
 UK. WC1E 6BT. [w] http://www.freshwaters.org.uk
%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%

__
R-help@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.


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

2011-01-23 Thread torbjore

I think you guys make it more difficult than it has to be. Estimating
probability of success with a loglog-link is equivalent to estimating
probability of failure with a cloglog-link, so all you have to do is to
change the response variable accordingly (and then you can interpret
parameter estimates (or any contrasts in general) as hazard ratios)...

Though, I wish there was a loglog-link in glm and lmer so you wouldn't have
to do this.
-- 
View this message in context: 
http://r.789695.n4.nabble.com/using-loglog-link-in-VGAM-or-creating-loglog-link-for-GLM-tp898386p3232866.html
Sent from the R help mailing list archive at Nabble.com.

__
R-help@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.


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

2009-08-23 Thread Gavin Simpson
On Fri, 2009-08-21 at 18:27 -0400, 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.

I was looking at different link functions for binomial glms recently for
the same reason as you (more zeros than ones). I did a bit of reading up
on the various link functions and IIRC, you can use the cloglog link on
your data, just turn your 0's into 1's and vice versa. This was stated
in the one or two references I looked at as to why only one of cloglog
and loglog links is often provided in software.

HTH

G

 
 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@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.
-- 
%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%
 Dr. Gavin Simpson [t] +44 (0)20 7679 0522
 ECRC, UCL Geography,  [f] +44 (0)20 7679 0565
 Pearson Building, [e] gavin.simpsonATNOSPAMucl.ac.uk
 Gower Street, London  [w] http://www.ucl.ac.uk/~ucfagls/
 UK. WC1E 6BT. [w] http://www.freshwaters.org.uk
%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%

__
R-help@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.


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

2009-08-22 Thread Kendra Walker



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


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

2009-08-22 Thread Mark Difford

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

__
R-help@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.