Gluschkoff / tst-depr

R-script for the publication Testosterone and specific symptoms of depression: Evidence from NHANES 2011–2016, https://doi.org/10.1016/j.cpnec.2021.100044
11 stars 2 forks source link

How to get the odds ratioes from the RCS analysis? #1

Open zhaoliang0302 opened 2 years ago

zhaoliang0302 commented 2 years ago

Hi Dr. Kia,

The code in the repository helps me a lot when I am studying the NHANES data analysis. In the plots.R file you plotted the predicted probabilities for specific symptoms using restricted cubic splines analysis, while the y-axis means the probability in the plot. If I want to describe the relationship between continuous data and a disease outcome (sick or not), how to modify the R code? The ideal plot may like this: image

Should I change the type parameter in this block (line 48)?

# specific symptoms: predicted probabilities and 95% confidence intervals, men
probs1 <- as.data.frame(predict(spl1, newdata=ndatamen, type="response")) 

Thanks

Gluschkoff commented 2 years ago

Hi,

Thanks for your question! I hope I understood you correctly: you would like to get model predicted odds ratios and plot them in a similar way I did with predicted probabilities. My understanding is that either predicted probabilities or marginal effects are actually the recommended way of presenting such results. This is because odds ratios are harder to interpret and they cannot be compared across studies or samples. So my recommendation is actually to use either predicted probabilities or marginal effects. See, for example: https://www.ncbi.nlm.nih.gov/pmc/articles/PMC5867187/ I am not, unfortunately, aware of any methods that would produce predicted odds ratios across different levels of a predictor directly from a regression model. With the predict function, you can obtain either probabilities (type=”response”, ranging from 0 to 1) or log-odds (type=”link”). Hope this helps!

Best wishes, Kia

From: Liang @.> Sent: keskiviikko 30. maaliskuuta 2022 18.26 To: Gluschkoff/tst-depr @.> Cc: Subscribed @.***> Subject: [Gluschkoff/tst-depr] How to get the odds ratioes from the RCS analysis? (Issue #1)

Hi Dr. Kia,

The code in the repository helps me a lot when I am studying the NHANES data analysis. In the plots.R file you plotted the predicted probabilities for specific symptoms using restricted cubic splines analysis, while the y-axis means the probability in the plot. If I want to describe the relationship between continuous data and a disease outcome (sick or not), how to modify the R code? The ideal plot may like this: [image]https://user-images.githubusercontent.com/42333702/160872081-3cfd1a6c-af85-41e0-a9fe-78c61078a120.png

Should I change the type parameter in this block (line 48)?

specific symptoms: predicted probabilities and 95% confidence intervals, men

probs1 <- as.data.frame(predict(spl1, newdata=ndatamen, type="response"))

Thanks

— Reply to this email directly, view it on GitHubhttps://github.com/Gluschkoff/tst-depr/issues/1, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AQEQRJOOPPRT6ETNEDK4VV3VCRXBXANCNFSM5SCKCKVQ. You are receiving this because you are subscribed to this thread.Message ID: @.**@.>>

zhaoliang0302 commented 2 years ago

Thank you so much for your reply! I searched a lot and found that rms package can do RCS analysis and produce the OR values for the next visualization (just like my ideal plot). However, the Predict funtion in the rms package only supports the regression model built with lrm and ols function, which means svyglm function is not allowed. Considering the survey weight is ignorable in the NHANES data analysis, I will follow your procedures in my next study. Thank you for your advice.