From Heather.Turner at warwick.ac.uk  Wed Feb 25 14:48:07 2009
From: Heather.Turner at warwick.ac.uk (Heather Turner)
Date: Wed, 25 Feb 2009 13:48:07 +0000
Subject: [Rd] [R] length 1 offset in glm (& lm)
In-Reply-To: <alpine.OSX.1.00.0902251316340.70608@tystie.local>
References: <49A53E1B.4090004@warwick.ac.uk>
	<alpine.OSX.1.00.0902251252010.70608@tystie.local>
	<20090225141510.vzf0j0passoso4sw@imp.inserm.fr>
	<alpine.OSX.1.00.0902251316340.70608@tystie.local>
Message-ID: <49A54C17.4070502@warwick.ac.uk>


Prof Brian Ripley wrote:
> On Wed, 25 Feb 2009, Kenneth Knoblauch wrote:
> 
>> Hi
>>
>> Quoting Prof Brian Ripley <ripley at stats.ox.ac.uk>:
>>
>>> On Wed, 25 Feb 2009, Heather Turner wrote:
>>>
>>>> This post about length 1 offsets on R help seems to have been ignored
>>>> (sorry deleted original email - is there a way to continue thread in
>>>> this case?)
>>>>
>>>> https://stat.ethz.ch/pipermail/r-help/2009-February/189352.html
>>>
>>> So let's be clear: this was the 'offset' argument' and not the offset()
>>> function as you refer to below.
>>
>> It occurs for both
> 
> Yes (I knew). but no one (AFAICS) said the function allows length-1
> arguments: Heather is raising the possibility that it should as new
> functionality, I believe.
> 
Not particularly, just observing that if the problem of handling a
length one offset passed to the offset argument is solved by model.frame
doing the necessary recycling, then offset() would also work with length
one arguments (I think) and this could be a useful feature. If the
problem is solved by dealing with the offset argument separately, then
you wouldn't get this side-benefit, so it's just something to bear in
mind when deciding on a fix.

>> c1 <- structure(list(Contr = c(0.028, 0.043, 0.064, 0.097, 0.146, 0.219
>> ), Correct = c(34L, 57L, 94L, 152L, 160L, 160L), Incorrect = c(126L,
>> 103L, 66L, 8L, 0L, 0L)), .Names = c("Contr", "Correct", "Incorrect"
>> ), row.names = c(NA, 6L), class = "data.frame")
>>
>> glm(cbind(Correct, Incorrect) ~ Contr + offset(qlogis(0.25)) - 1,
>> binomial,
>>     data = c1)
>> Error in model.frame.default(formula = cbind(Correct, Incorrect) ~
>> Contr +  :
>> variable lengths differ (found for 'offset(qlogis(0.25))')
>> +
>>
>> Thanks for looking into this when time permits.
>>
>> Ken
>>
>> --- remaining deleted
> 
>> -- 
>> Ken Knoblauch
>> Inserm U846
>> Stem-cell and Brain Research Institute
>> Department of Integrative Neurosciences
>> 18 avenue du Doyen L?pine
>> 69500 Bron
>> France
>> tel: +33 (0)4 72 91 34 77
>> fax: +33 (0)4 72 91 34 61
>> portable: +33 (0)6 84 10 64 10
>> http://www.sbri.fr/members/kenneth-knoblauch.html
>>
>



[Rd] [R] length 1 offset in glm (& lm)
Heather Turner