Paul Buerkner
2019-Aug-05 19:44 UTC
[Rd] Potential bug in update.formula when updating offsets
Hi all, update.formula does not seem to correctly update (i.e. remove in my case) offset terms. Here is an example: update(~x + offset(z), ~ . - offset(z))> ~x + offset(z)Also: update(~x, ~ . - offset(z))> ~x + offset(z)In both cases, I would expect the result> ~xas - <term> should remove <term> from the formula as happens for instance in: update(~x + z, ~ . - z)> ~xI don't know if this behavior is intentional but I would say it is at least unfortunate. Paul [[alternative HTML version deleted]]
peter dalgaard
2019-Aug-06 08:21 UTC
[Rd] Potential bug in update.formula when updating offsets
Terry, Martin Would this happen to be related to the "indexing term objects" issue that has been bothering you? -pd> On 5 Aug 2019, at 21:44 , Paul Buerkner <paul.buerkner at gmail.com> wrote: > > Hi all, > > update.formula does not seem to correctly update (i.e. remove in my case) > offset terms. > > Here is an example: > > update(~x + offset(z), ~ . - offset(z)) >> ~x + offset(z) > > Also: > update(~x, ~ . - offset(z)) >> ~x + offset(z) > > In both cases, I would expect the result >> ~x > > as - <term> should remove <term> from the formula as happens for instance > in: > > update(~x + z, ~ . - z) >> ~x > > I don't know if this behavior is intentional but I would say it is at least > unfortunate. > > Paul > > [[alternative HTML version deleted]] > > ______________________________________________ > R-devel at r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-devel-- Peter Dalgaard, Professor, Center for Statistics, Copenhagen Business School Solbjerg Plads 3, 2000 Frederiksberg, Denmark Phone: (+45)38153501 Office: A 4.23 Email: pd.mes at cbs.dk Priv: PDalgd at gmail.com
Therneau, Terry M., Ph.D.
2019-Aug-06 12:46 UTC
[Rd] [EXTERNAL] Re: Potential bug in update.formula when updating offsets
Yes, it is almost certainly the same issue.? At useR I promised Martin that I would put together a clear example and fix for him and I have not yet done so.? I will try to do that this week. ? The heart of the issue is that in a terms object the offset expression will apear in the 'variables' attribute but not in the 'term.labels' or 'order' attributes, and the base code tries to use the same subscripting vector for all 3 if then. ? The same bit of code shows up in update.formula and in [.formula; a fix for one can be applied to both. I had all this worked out, then had some problems logging into buzilla, then sent it to Martin about the same time 2-3 more urgent things got dumped on him, and then we've both let it lie. At useR he said (and I've no reason to disagree) that my prior note was unclear.? Let me recreate the example and fix, more carefully. Terry T. On 8/6/19 3:21 AM, peter dalgaard wrote:> Terry, Martin > > Would this happen to be related to the "indexing term objects" issue that has been bothering you? > > -pd > >> On 5 Aug 2019, at 21:44 , Paul Buerkner <paul.buerkner at gmail.com> wrote: >> >> Hi all, >> >> update.formula does not seem to correctly update (i.e. remove in my case) >> offset terms. >> >> Here is an example: >> >> update(~x + offset(z), ~ . - offset(z)) >>> ~x + offset(z) >> Also: >> update(~x, ~ . - offset(z)) >>> ~x + offset(z) >> In both cases, I would expect the result >>> ~x >> as - <term> should remove <term> from the formula as happens for instance >> in: >> >> update(~x + z, ~ . - z) >>> ~x >> I don't know if this behavior is intentional but I would say it is at least >> unfortunate. >> >> Paul >> >> [[alternative HTML version deleted]] >> >> ______________________________________________ >> R-devel at r-project.org mailing list >> https://stat.ethz.ch/mailman/listinfo/r-devel[[alternative HTML version deleted]]