# Checking Heteroskedasticity in ANCOVA models : Breusch-Pagan test?

I would like to check the heteroskedaticity in an ANCOVA model :

f0 <- formula(delta_area_habitat~x+dike+security_net+height_cliff+height_habitat+dike:security_net+dike:x+dike:height+dike:height_habitat)
lm0 <- lm(f0,data=data_habitat)


I am working on the evolution of natural habitats on a coastal cliff. The interest variable is the variation of a given habitat on a part of a cliff (I divided the cliff in several parts for the study). A dike is being constructed in front of this dike and some parts of the cliff are covered by security nets. Dike is a factor (yes or no : there is a dike in front of this part of the cliff or not) and the others variables are quantitative. So that was for the context.

I want to test the heteroskedasticity hypothesis to know if I am allow to use a linear model or if I have to switch to something else.

When I plot the model, I see that there could have a heterogeneity problem (and maybe a normality problem that a shapiro wilk test has confirmed). I think that Breusch-Pagan test could work but I don't know which R function I should use (ncvTest? bptest ? they don't give the same results)

> bptest(lm0)

studentized Breusch-Pagan test

data:  (lm0)
BP = 7.5542, df = 9, p-value = 0.5796

> ncvTest(lm0)
Non-constant Variance Score Test
Variance formula: ~ fitted.values
Chisquare = 4.059348, Df = 1, p = 0.043927


So the main question is : which test can I use to check heteroskedasticity in this kind of model ? (And then, I might have some others question on using linear model when the hypothesis are not completely respected and how to deal with heterogeneity problems ...)

Thank you, Lucas

• bpTest returns the same results as ncvTest, if you set the argument studentize=F. – user2974951 Jul 24 at 7:59