[R] Help with Bartlett's test on linear model

Ben Bolker bolker at ufl.edu
Wed Nov 14 22:19:48 CET 2007




Stephanie Bernard wrote:
> 
> Hi all,
> I would like to test the homoegeneity of variances between several 
> linear model for some analysis of covariance. It seems that the 
> Bartlett's test is a good test to use but I am having problem using with 
> linear model and I cannot find any examples on the internet. There are 
> some examples for comparisons of variances but not linear models.
> If I take the hellung data set, which is the example in Dalgaard's book. 
> I know var.test works fine but I want to learn how to use the Bartlett's 
> test.
>  > hellung$glucose <- factor(hellung$glucose, labels=c("Yes","No"))
>  > attach(hellung)
>  > tethym.gluc <- hellung[glucose=="Yes",]
>  > tethym.nogluc <- hellung[glucose=="No",]
>  > lm.nogluc <- lm(log10(diameter)~log10(conc), data=tethym.nogluc)
>  > lm.gluc <- lm(log10(diameter)~log10(conc), data=tethym.gluc)
> I guess I have two questions. 1) How to use bartlett.test with linear 
> model (using the model above) and 2) how to test for homogeneity of 
> variances of linear models when there are more than two groups.
> 

1.

bartlett.test(list(lm.gluc,lm.nogluc))

2.

x = rnorm(40,sd=1)
y = rnorm(40,sd=2)
z = rnorm(40,sd=3)
bartlett.test(list(x,y,z))

-- 
View this message in context: http://www.nabble.com/Help-with-Bartlett%27s-test-on-linear-model-tf4807461.html#a13756626
Sent from the R help mailing list archive at Nabble.com.



More information about the R-help mailing list