[R] update not working

Ista Zahn izahn at psych.rochester.edu
Wed Feb 2 16:29:37 CET 2011


Hi Luis,
Well, when I copied your code I discovered that
On Wed, Feb 2, 2011 at 9:42 AM, Luis Ridao <luridao at gmail.com> wrote:
> R-help,
>
> I'm using the "update" command for a multiple regression model and it is
> just not working:
>
>> update(model1, . ~ . – temp:wind:rad,data=ozone.pollution)
                                    ^
                          this is not a minus sign!
Are you using a word processer to write your code?

update(ozone ~ temp * wind * rad + I(rad^2) + I(temp^2) + I(wind^2), .
~ . -temp:wind:rad)

works for me.

Best,
Ista

> Error: unexpected input in "model2<-update(model1, . ~ . –"
>
>> summary(model1)
>
> Call:
> lm(formula = ozone ~ temp * wind * rad + I(rad^2) + I(temp^2) +
>    I(wind^2), data = ozone.pollution)
>
> Residuals:
>    Min      1Q  Median      3Q     Max
> -38.894 -11.205  -2.736   8.809  70.551
>
> Coefficients:
>                Estimate Std. Error t value Pr(>|t|)
> (Intercept)    5.683e+02  2.073e+02   2.741  0.00725 **
> temp          -1.076e+01  4.303e+00  -2.501  0.01401 *
> wind          -3.237e+01  1.173e+01  -2.760  0.00687 **
> rad           -3.117e-01  5.585e-01  -0.558  0.57799
> I(rad^2)      -3.619e-04  2.573e-04  -1.407  0.16265
> I(temp^2)      5.833e-02  2.396e-02   2.435  0.01668 *
> I(wind^2)      6.106e-01  1.469e-01   4.157 6.81e-05 ***
> temp:wind      2.377e-01  1.367e-01   1.739  0.08519 .
> temp:rad       8.403e-03  7.512e-03   1.119  0.26602
> wind:rad       2.054e-02  4.892e-02   0.420  0.67552
> temp:wind:rad -4.324e-04  6.595e-04  -0.656  0.51358
> ---
> Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
>
> Residual standard error: 17.82 on 100 degrees of freedom
> Multiple R-squared: 0.7394,     Adjusted R-squared: 0.7133
> F-statistic: 28.37 on 10 and 100 DF,  p-value: < 2.2e-16
>
>>
>
> Can anyone help with this?
>
> Thanks in advance
>
>        [[alternative HTML version deleted]]
>
>
> ______________________________________________
> R-help at 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.
>
>



-- 
Ista Zahn
Graduate student
University of Rochester
Department of Clinical and Social Psychology
http://yourpsyche.org



More information about the R-help mailing list