nptrend.test {epicalc} | R Documentation |
Test for trend across ordered groups
## S3 method for class 'test' nptrend(group, cont.var, score=NULL, alternative = "two.sided", decimal=3, ...)
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. |
This is a variant of Kruskal-Wallis test where the group is ordinal instead of categorical. 'score' specifies relative position of each group.
An object of class "nptrend" with title, z statistic, p-value, etc.
Jirawain Sopsuk <jnid@hotmail.com>
‘kruskal.test’
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))