davies.test {segmented}R Documentation

Testing for a change in the slope

Description

Given a generalized linear model, the Davies' test can be employed to test for a non-constant regression parameter in the linear predictor.

Usage

davies.test(ogg, term, k = 10, alternative = c("two.sided", "less", "greater"))

Arguments

ogg a fitted model returned by glm or lm.
term a character string to mean the segmented variable being tested.
k number of points where the test should be evaluated. See details.
alternative a character string specifying the alternative hypothesis.

Details

davies.test tests for a non zero difference-in-slope parameter of a segmented relationship. Roughtly speaking, the procedure computes k `naive' (i.e. assuming fixed and known the breakpoint) Wald statistics for the difference-in-slope, seeks the `best' value (according to the alternative hypothesis), and then corrects the selected (minimum) p-value. The k evaluation points are the quantiles of the variable term.

Value

A list with class 'htest' containing the following components:

method title (character)
data.name the regression model and the segmented variable being tested
statistic the point at which the maximum (or the minimum if alternative="less") occurs
parameter number of evaluation points
p.value the adjusted p-value

Warning

Currently davies.test does not work if the fitted model ogg has been built without the argument data.

Note

Strictly speaking, the Davies test is not confined to the segmented regression; the procedure can be applied when a nuicance parameter vanishes under the null hypothesis. The test is slightly conservative, as the computed p-value is actually an upper bound.

Author(s)

Vito M.R. Muggeo

References

Davies, R.B. (1987) Hypothesis testing when a nuisance parameter is present only under the alternative. Biometrika 74, 33–43.

Examples

set.seed(20)
z<-runif(100)
x<-rnorm(100,2)
y<-2+10*pmax(z-.5,0)+rnorm(100,0,2)
o<-lm(y~z+x)

davies.test(o,"z")
davies.test(o,"x")

[Package segmented version 0.2-4 Index]