anova function not giving results

when I type command anova (lm() no result comes. Did I do
anything wrong?

 ctl <- c(4.17,5.58,5.18,6.11,4.50,4.61,5.17,4.53,5.33,5.14)
> trt <- c(4.81,4.17,4.41,3.59,5.87,3.83,6.03,4.89,4.32,4.69)
> group <- gl(2,10, labels=c("Ctl","Trt"))
> weight <- c(ctl,trt)
> anova  (lm(weight~group))
>   #Analysis of Variance Table
> summary(lm(weight~group -1))
>   #Analysis of Variance Table
> summary(lm(weight~group -1))
>

Try cutting and pasting this

ctl <- c(4.17,5.58,5.18,6.11,4.50,4.61,5.17,4.53,5.33,5.14)
trt <- c(4.81,4.17,4.41,3.59,5.87,3.83,6.03,4.89,4.32,4.69)
group <- gl(2,10, labels=c("Ctl","Trt"))
weight <- c(ctl,trt)
anova  (lm(weight~group))
#> Analysis of Variance Table
#> 
#> Response: weight
#>           Df Sum Sq Mean Sq F value Pr(>F)
#> group      1 0.6882 0.68820  1.4191  0.249
#> Residuals 18 8.7292 0.48496
summary(lm(weight~group -1))
#> 
#> Call:
#> lm(formula = weight ~ group - 1)
#> 
#> Residuals:
#>     Min      1Q  Median      3Q     Max 
#> -1.0710 -0.4938  0.0685  0.2462  1.3690 
#> 
#> Coefficients:
#>          Estimate Std. Error t value Pr(>|t|)    
#> groupCtl   5.0320     0.2202   22.85 9.55e-15 ***
#> groupTrt   4.6610     0.2202   21.16 3.62e-14 ***
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> Residual standard error: 0.6964 on 18 degrees of freedom
#> Multiple R-squared:  0.9818, Adjusted R-squared:  0.9798 
#> F-statistic: 485.1 on 2 and 18 DF,  p-value: < 2.2e-16

thanks for your help. It was a version problem. I downloaded latest version.

1 Like

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.