[R] Calculating a P for trend

Bert Gunter bgunter@4567 @ending from gm@il@com
Thu Nov 29 18:23:45 CET 2018


I would suggest that if at all possible, you find a local statistician
(your instructor??) with whom to consult. Much of what you are doing
appears likely to result in irreproducible nonsense.

This list is concerned with R programming, not statistics, although they
sometimes do intersect. So I think your post is off topic here (but others
may disagree).

Cheers,
Bert


Bert Gunter

"The trouble with having an open mind is that people keep coming along and
sticking things into it."
-- Opus (aka Berkeley Breathed in his "Bloom County" comic strip )


On Thu, Nov 29, 2018 at 8:50 AM Lisa van der Burgh <407600ab using student.eur.nl>
wrote:

> 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]]
>
> ______________________________________________
> R-help using r-project.org mailing list -- To UNSUBSCRIBE and more, see
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide
> http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>

	[[alternative HTML version deleted]]



More information about the R-help mailing list