nptrend.test {epicalc}R Documentation

Non-parametric test for linear trend across ordered groups

Description

Test for trend across ordered groups

Usage

## S3 method for class 'test'
nptrend(group, cont.var, score=NULL, alternative = "two.sided",
 decimal=3, ...)

Arguments

group

grouping variable

cont.var

a continuous variable

score

score for order of group. If not specified, the order of the group is used

alternative

a character string specifying the alternative hypothesis, must be one of "two.sided" (default), "greater" or "less".

decimal

number of digits to be displayed after the decimal point

...

further arguments passed to or used by methods.

Details

This is a variant of Kruskal-Wallis test where the group is ordinal instead of categorical. 'score' specifies relative position of each group.

Value

An object of class "nptrend" with title, z statistic, p-value, etc.

Author(s)

Jirawain Sopsuk <jnid@hotmail.com>

See Also

‘kruskal.test’

Examples

group<-c(rep(1,6),rep(2,18),rep(3,8))
exposure<-c(1.4,1.4,1.4,1.6,2.3,2.3,0.9,1.0,1.1,1.1,1.2,1.2,1.5,1.9,2.2,2.6,
            2.6,2.6,2.8,2.8,3.2,3.5,4.3,5.1,0.8,1.7,1.7,1.7,3.4,7.1,8.9,13.5)
nptrend.test(group, exposure)
nptrend.test(group, exposure,score=c(1,2,5))

[Package epicalc version 3.5.1.8 Index]