[R] glm with family binomial and link identity

Ralf Goertz r_goertz @end|ng |rom web@de
Thu Apr 28 18:16:46 CEST 2022


Am Thu, 28 Apr 2022 17:40:41 +0200
schrieb Martin Maechler <maechler using stat.math.ethz.ch>:

> >>>>> Ralf Goertz 
> >>>>>     on Thu, 28 Apr 2022 17:13:08 +0200 writes:  
> 
>> Am Thu, 28 Apr 2022 16:48:14 +0200
>> schrieb Martin Maechler <maechler using stat.math.ethz.ch>:  
>
>>> TLDR:  No, there was no such change in R 4.2.0  
>
>> Yeah sorry, now there are three mails and what I really want to
>> know is in the third (from 28 Apr 2022 09:53:39 +0200):  
>
>> On the other hand why do I get this following error at all?  
>
>> Error in binomial(link = identity) : 
>> link "identity" not available for binomial family; available
>> links are ‘logit’, ‘probit’, ‘cloglog’, ‘cauchit’, ‘log’  
>
>> This is a bit misleading since identity is a legitimate link
>> function and works perfectly *when* *quoted*.  
>
>> Short enough? :-)  
> 
> Well, now you did not read what I wrote, cited here again :

Yes, you're right, and again I have to say, sorry. 

>> HOWEVER, this all has been documented for a long time,
>> in  ?family == ?binomial  
>
>>   Note:  
>
>> 	 The ‘link’ and ‘variance’ arguments have rather awkward
>> semantics for back-compatibility.  The recommended way is to supply
>> them as quoted character strings, but they can also be supplied
>> unquoted (as names or expressions).  Additionally, they can be
>> supplied as a length-one character vector giving the name of one of
>> the options, or as a list (for ‘link’, of class ‘"link-glm"’).  The
>> 	 restrictions apply only to links given as names: when
>> given as a character string all the links known to make.link are
>> accepted.  

The current behaviour is documented, right. But why is it this way?
Back-compatibility doesn't make much sense IMHO. The unquoted link
function identity leads to an error for the family binomial. So unless
it is important that an unquoted link function that works perfectly when
quoted leads to an error there is no reason for not accepting an
unquoted (named) function. (Maybe the ambiguity mentioned for the
example of logit is a good reason, but I didn't really understand that.)

I fell into the trap of first using the (unquoted) links "log" and
"logit" and then trying "identity" only to be told that identity is not
available for the family binomial, clearly remembering having used it
successfully in the past which is the reason I didn't bother to read
through "?family" and rather asked a colleague with an older version to
try. He (using quotes, but neither of us new about how the other did it)
succeeded which made me think there had been a change. So if it really
is important not to accept certain unquoted functions at least the error
message should be changed in order to inform the user about the
possibility of using quotation.



More information about the R-help mailing list