简体   繁体   中英

Test for trend across ordered groups

How can I test for trend across ordered groups. I am using prop.trend.test but it doesn't order into groups and doesn't give the expected output of sum of ranks , z value ... I am using this command prop.trend.test (birthweight2$lbw2 ,birthweight2$gestwkgp )

I have this data set

lbw2          gestwkgp  
normal birth weight 3
normal birth weight 3
normal birth weight 3
normal birth weight 4
normal birth weight 3
normal birth weight 3
normal birth weight 3
normal birth weight 4
low birth weight    2
normal birth weight 4
normal birth weight 4
normal birth weight 3
normal birth weight 4
normal birth weight 3
normal birth weight 3
normal birth weight 3
normal birth weight 2
normal birth weight 3
normal birth weight 3
normal birth weight 3
normal birth weight 3
normal birth weight 4
normal birth weight 3
normal birth weight 4
normal birth weight 4
normal birth weight 3
normal birth weight 3
normal birth weight 3
low birth weight    3
low birth weight    3
normal birth weight 3
normal birth weight 3
normal birth weight 3
low birth weight    1
normal birth weight 3
normal birth weight 4
normal birth weight 3
normal birth weight 4
normal birth weight 3
normal birth weight 3
normal birth weight 4
normal birth weight 3
low birth weight    1
normal birth weight 3
normal birth weight 3
normal birth weight 3
normal birth weight 3
normal birth weight 4
normal birth weight 3
normal birth weight 4
normal birth weight 3
normal birth weight 3
normal birth weight 3
normal birth weight 3
normal birth weight 3
normal birth weight 4
normal birth weight 3
normal birth weight 3
normal birth weight 3
normal birth weight 2
normal birth weight 3
low birth weight    2
normal birth weight 3
low birth weight    2
low birth weight    2
normal birth weight 4
normal birth weight 2
normal birth weight 3
low birth weight    1
normal birth weight 3
normal birth weight 3
low birth weight    1
normal birth weight 3
normal birth weight 3
normal birth weight 3
normal birth weight 3
low birth weight    2
normal birth weight 4
low birth weight    2
normal birth weight 3
normal birth weight 3
normal birth weight 3
normal birth weight 2
normal birth weight 3
normal birth weight 3
low birth weight    1
normal birth weight 4
normal birth weight 3
normal birth weight 3
normal birth weight 3
normal birth weight 3
normal birth weight 2
normal birth weight 3
normal birth weight 3
normal birth weight 2
normal birth weight 3
normal birth weight 3
normal birth weight 3
normal birth weight 3
normal birth weight 3
normal birth weight 3
normal birth weight 3
normal birth weight 3
normal birth weight 3
normal birth weight 4

I don't think this is how prop.trend.test is meant to work. You need an additional qualifier that bins your data into a before/after scenario. Then you want to see if there is any difference between the low/normal weight across these two scenarios. Think about formulating your problem as a 2x2 contingency table where the columns are the before/after and the rows are weigh categories.

                 BEFORE    AFTER
low-weigh         freq     freq
normal-weight     freq     freq

The question then becomes like if the treatment has any effect on the weight, so the syntax of the function will become:

 prop.trend.test(c(low-weight-after, normal-weight-after),c(rowSums(contingency_table) ))

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM