[R] Calculating a P for trend
Lisa van der Burgh
407600@b @ending from @tudent@eur@nl
Thu Nov 29 16:15:18 CET 2018
Hi all,
I have a question about calculating a P for trend on my data. Let�s give an example that is similar to my own situation first: I have a continuous outcome, namely BMI. I want to investigate the effect of a specific medicine, let�s call it MedA on BMI. MedA is a variable that is categorical, coded as yes/no use of the medication. A also have the duration of use of the MedA, divided in three categories: use of MedA for 1-30 days, use of MedA for 31-60 days and use of MedA for 61-120 days (categories based on literature). I have performed a linear regression analyses and it seems like there is some kind of trend: the longer the use of MedA, the higher the BMI will be (the betas increase with time of use). So an exemplary table:
Outcome: BMI
Beta
MedA use duration
Use for 1-30 days
0.060
Use for 31-60 days
0.074
Use for 61-120 da
0.081
So, I have created three variables and I modelled them in Rstudio (on a multiple imputed dataset using MICE):
mod1 <- with(imp, lm(BMI ~ MedA_1to30))
pool_ mod1 <- pool(mod1)
summary(pool_ mod1, conf.int = TRUE)
mod2 <- with(imp, lm(BMI ~ MedA_31to60))
pool_ mod2 <- pool(mod2)
summary(pool_ mod2, conf.int = TRUE)
mod3 <- with(imp, lm(BMI ~ MedA_61to120))
pool_ mod3 <- pool(mod3)
summary(pool_ mod3, conf.int = TRUE)
Now that I have done this, I want to calculate a p for trend. I do know what a P for trend measures, but I do not know how to calculate this myself. I read something about the partial.cor.trend.test() function from the trend package, but I do not know what I should fill in. Because I can only fill in an x and y, but I have three time variables. So I do not know how to solve this. Can somebody help me?
If more information is necessary, I am happy to give it to you!
[[alternative HTML version deleted]]
More information about the R-help
mailing list