# [R] Suitable test for ordinal variable vs continuous variable trend

Greg Snow Greg.Snow at imail.org
Thu Dec 2 19:03:30 CET 2010

```There are many possibilities depending on what you are really looking for (strict increasing, vs. increasing or constant, vs. general trend, etc.)

I would start with a plot of the data, that may result in a significant interocular concussion test and will at least help you understand what is happening in your data.

The plotting idea can be extended to a more formal test if you have a clear null hypothesis and a way to simulate from the null (e.g. if the null is no relationship, then you can just permute one of the variables) by using the vis.test function in the TeachingDemos package.

You could calculate the correlation between the continuous variable and as.numeric(ordered variable) as a spearman like correlation which would give a general trend.

You could do a linear regression (assuming the continuous variable is close enough to normal conditional on the ordered one) with contrasts set to measure the differences in successive groups, then if all the coefficients are significant and of the same sign, then you have a clear monotonic trend, if you have some that are significant but of different signs then you clearly don't have a monotonic trend, if some are non significant then you need to decide what that means for you.

--
Gregory (Greg) L. Snow Ph.D.
Statistical Data Center
Intermountain Healthcare
greg.snow at imail.org
801.408.8111

> -----Original Message-----
> From: r-help-bounces at r-project.org [mailto:r-help-bounces at r-
> project.org] On Behalf Of Daniel Brewer
> Sent: Thursday, December 02, 2010 7:17 AM
> To: r-help at r-project.org
> Subject: [R] Suitable test for ordinal variable vs continuous variable
> trend
>
> Dear all,
>
> For a population of about 200 I have a continuous variable and an
> ordinal variable.  The question I would like to ask is whether the
> continuously increases (or decreases) as the rank of the ordinal
> variable increases.  I was thinking that a Spearmen's rank correlation
> or or a chi squared trend might be appropriate.  I don't have any
> experience dealing with ordinal variables so I am at a bit of a loss.
> What is the most appropriate test? and is it implemented in R?
>
> Many thanks
>
>
> **************************************************************
>
> Daniel Brewer
>
> Institute of Cancer Research
> Molecular Carcinogenesis
> MUCRC
> Sutton, Surrey SM2 5NG
> United Kingdom
>
> Tel: +44 (0) 20 8722 4109
> Fax: +44 (0) 20 8722 4141
>
> Email: daniel.brewer at icr.ac.uk
>
> **************************************************************
>
> The Institute of Cancer Research: Royal Cancer Hospital, a charitable
> Company Limited by Guarantee, Registered in England under Company No.
> 534147 with its Registered Office at 123 Old Brompton Road, London SW7
> 3RP.
>
> This e-mail message is confidential and for use by the
> a...{{dropped:5}}
>
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help