Robin Hankin
2006-Apr-27 14:30 UTC
[R] summary(lm(x~y)) difference between R-2.2.1 and R-2.3.0
Hi [macOSX 10.4.6; R-2.3.0] I have encountered a difference in behaviour between R-2.2.1 and R-2.3.0 when performing a linear model. Transcript follows for R-2.3.0 (R-2.2.1 worked as expected). How to make R-2.3.0 perform as R-2.2.1 did? > dput(x) c(29.13, 29.88, 30.09, 29.99, 29.74, 29.64, 29.65, 29.7, 30.04, 29.89, 29.96, 29.65, 28.76, 28.41, 28.38, 29.55, 29.76, 29.75, 29.84, 29.85, 29.75, 29.99, 29.32, 29.38, 28.97, 28.48, 29.06, 28.74, 29.23, 29.16, 29.19, 29.23, 29.17, 29.25, 29.24, 29.22, 29.15, 29.15, 28.78, 29.28, 29.31, 29.44, 29.28, 29.47, 29.28, 29.32, 29.39, 29.27, 28.68, 28.73, 28.09, 28.19, 29.1, 29.1, 29.14, 29.48, 29.48, 29.39, 29.39, 29.22, 28.95, 29.11, 27.94, 28.32, 27.98, 28.22, 28.89, 29.4, 29.28, 29.66, 30.05, 30.12, 30.09, 29.85, 29.99, 29.92, 28.44, 28.92, 28.92, 28.94, 28.97, 28.95, 29.39, 29.26, 29.7, 29.48, 29.72, 29.71, 29.84, 29.59, 29.17, 29.39, 29.27, 29.39, 28.53, 29.32, 29.32, 28.44, 29.39, 28.55, 29.39, 29.46, 29.73, 30.01, 30.11, 30.25, 30.37, 30.22, 30.33, 30.35, 30.38, 30.25, 29.27, 27.34) > dput(y) c(36, 72.43, 37.57, 72.78, 55.88, 38.41, 79.79, 32, 56.92, 69.72, 63.53, 50.94, 82.82, 50.77, 41.05, 75.62, 64, 63.04, 35.83, 91.71, 93.29, 42.16, 65.57, 60.05, 27.38, 83.64, 67.6, 39, 53.21, 54.24, 49.58, 34.29, 81.5, 48.94, 64.84, 32.86, 66.71, 41.67, 42.27, 45.22, 51.23, 64.03, 58, 48.15, 59.8, 72.94, 40.33, 56.82, 32, 75.32, 49.25, 44.38, 27.5, 37, 40.22, 33.63, 43, 49.92, 36, 63.78, 41.74, 58.07, 37.5, 41.27, 54.28, 51.39, 49.92, 93, 33.75, 30.81, 102.31, 67.95, 64.48, 47, 33.56, 42.44, 44.25, 63.93, 38.92, 74.47, 58.46, 35.25, 94.45, 40.71, 38.35, 78.26, 65.1, 89.54, 43.34, 34.71, 37.83, 62.45, 31.43, 38.14, 50, 75.77, 88.14, 60.14, 42.02, 36.79, 34.9, 46.33, 47.55, 35.67, 75.41, 28.6, 61.29, 62.43, 59.08, 46.3, 84.56, 43.96, 91.68, 41.67) > summary(lm(x~y)) Call: lm(formula = x ~ y) Residuals: *** caught bus error *** address 0x18, cause 'invalid alignment' Traceback: 1: sort(x, partial = unique(c(lo, hi))) 2: quantile.default(resid) 3: quantile(resid) 4: structure(quantile(resid), names = nam) 5: print.summary.lm(list(call = lm(formula = x ~ y), terms = x ~ y, residuals = c(-0.0990169973225879, 0.442597843688031, 0.852002363105233, 0.550595790280227, 0.397266369114154, 0.397197434926506, 0.170497520598225, 0.493863613052272, 0.691317410416682, 0.468099457217023, 0.573507201772172, 0.335523922927148, -0.736834541760754, -0.903503651131917, -0.877903767920926, 0.0943505569140546, 0.370818730053123, 0.366310076543096, 0.6119 [snip] -- Robin Hankin Uncertainty Analyst National Oceanography Centre, Southampton European Way, Southampton SO14 3ZH, UK tel 023-8059-7743
roger bos
2006-Apr-27 14:44 UTC
[R] summary(lm(x~y)) difference between R-2.2.1 and R-2.3.0
I don't know if this is causing the error, by in your traceback I saw sort() was used and sort now removes all the attributes when it sorts. I used to use sort() to sort dates in character format and now it turns them into integers and is breaking all my code. The problem with upgrading is your never know what the end result will be on your code. Check and see if your data needs the attributes to remain in order to function properly. On 4/27/06, Robin Hankin <r.hankin@noc.soton.ac.uk> wrote:> > Hi > > [macOSX 10.4.6; R-2.3.0] > > I have encountered a difference in behaviour between R-2.2.1 and > R-2.3.0 when > performing a linear model. Transcript follows for R-2.3.0 (R-2.2.1 > worked as > expected). How to make R-2.3.0 perform as R-2.2.1 did? > > > > > dput(x) > c(29.13, 29.88, 30.09, 29.99, 29.74, 29.64, 29.65, 29.7, 30.04, > 29.89, 29.96, 29.65, 28.76, 28.41, 28.38, 29.55, 29.76, 29.75, > 29.84, 29.85, 29.75, 29.99, 29.32, 29.38, 28.97, 28.48, 29.06, > 28.74, 29.23, 29.16, 29.19, 29.23, 29.17, 29.25, 29.24, 29.22, > 29.15, 29.15, 28.78, 29.28, 29.31, 29.44, 29.28, 29.47, 29.28, > 29.32, 29.39, 29.27, 28.68, 28.73, 28.09, 28.19, 29.1, 29.1, > 29.14, 29.48, 29.48, 29.39, 29.39, 29.22, 28.95, 29.11, 27.94, > 28.32, 27.98, 28.22, 28.89, 29.4, 29.28, 29.66, 30.05, 30.12, > 30.09, 29.85, 29.99, 29.92, 28.44, 28.92, 28.92, 28.94, 28.97, > 28.95, 29.39, 29.26, 29.7, 29.48, 29.72, 29.71, 29.84, 29.59, > 29.17, 29.39, 29.27, 29.39, 28.53, 29.32, 29.32, 28.44, 29.39, > 28.55, 29.39, 29.46, 29.73, 30.01, 30.11, 30.25, 30.37, 30.22, > 30.33, 30.35, 30.38, 30.25, 29.27, 27.34) > > dput(y) > c(36, 72.43, 37.57, 72.78, 55.88, 38.41, 79.79, 32, 56.92, 69.72, > 63.53, 50.94, 82.82, 50.77, 41.05, 75.62, 64, 63.04, 35.83, 91.71, > 93.29, 42.16, 65.57, 60.05, 27.38, 83.64, 67.6, 39, 53.21, 54.24, > 49.58, 34.29, 81.5, 48.94, 64.84, 32.86, 66.71, 41.67, 42.27, > 45.22, 51.23, 64.03, 58, 48.15, 59.8, 72.94, 40.33, 56.82, 32, > 75.32, 49.25, 44.38, 27.5, 37, 40.22, 33.63, 43, 49.92, 36, 63.78, > 41.74, 58.07, 37.5, 41.27, 54.28, 51.39, 49.92, 93, 33.75, 30.81, > 102.31, 67.95, 64.48, 47, 33.56, 42.44, 44.25, 63.93, 38.92, > 74.47, 58.46, 35.25, 94.45, 40.71, 38.35, 78.26, 65.1, 89.54, > 43.34, 34.71, 37.83, 62.45, 31.43, 38.14, 50, 75.77, 88.14, 60.14, > 42.02, 36.79, 34.9, 46.33, 47.55, 35.67, 75.41, 28.6, 61.29, > 62.43, 59.08, 46.3, 84.56, 43.96, 91.68, 41.67) > > summary(lm(x~y)) > > Call: > lm(formula = x ~ y) > > Residuals: > > *** caught bus error *** > address 0x18, cause 'invalid alignment' > > Traceback: > 1: sort(x, partial = unique(c(lo, hi))) > 2: quantile.default(resid) > 3: quantile(resid) > 4: structure(quantile(resid), names = nam) > 5: print.summary.lm(list(call = lm(formula = x ~ y), terms = x ~ > y, residuals = c(-0.0990169973225879, 0.442597843688031, > 0.852002363105233, 0.550595790280227, 0.397266369114154, > 0.397197434926506, 0.170497520598225, 0.493863613052272, > 0.691317410416682, 0.468099457217023, 0.573507201772172, > 0.335523922927148, -0.736834541760754, -0.903503651131917, > -0.877903767920926, 0.0943505569140546, 0.370818730053123, > 0.366310076543096, 0.6119 > [snip] > > > > > -- > Robin Hankin > Uncertainty Analyst > National Oceanography Centre, Southampton > European Way, Southampton SO14 3ZH, UK > tel 023-8059-7743 > > ______________________________________________ > R-help@stat.math.ethz.ch mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide! > http://www.R-project.org/posting-guide.html >[[alternative HTML version deleted]]
Robin Hankin
2006-Apr-27 14:50 UTC
[R] summary(lm(x~y)) difference between R-2.2.1 and R-2.3.0
Hi Roger good point. I can reproduce the error much more simply: > x <- 1:10 > y <- 10:1 > summary(lm(x~y)) Call: lm(formula = x ~ y) Residuals: *** caught bus error *** address 0x18, cause 'invalid alignment' Traceback: 1: sort(x, partial = unique(c(lo, hi))) 2: quantile.default(resid) 3: quantile(resid) 4: structure(quantile(resid), names = nam) 5: print.summary.lm(list(call = lm(formula = x ~ [snip] On 27 Apr 2006, at 15:44, roger bos wrote:> I don't know if this is causing the error, by in your traceback I > saw sort() > was used and sort now removes all the attributes when it sorts. I > used to > use sort() to sort dates in character format and now it turns them > into > integers and is breaking all my code. The problem with upgrading > is your > never know what the end result will be on your code. Check and see > if your > data needs the attributes to remain in order to function properly. > > > > On 4/27/06, Robin Hankin <r.hankin at noc.soton.ac.uk> wrote: >> >> Hi >>-- Robin Hankin Uncertainty Analyst National Oceanography Centre, Southampton European Way, Southampton SO14 3ZH, UK tel 023-8059-7743