Luis Fernando GarcĂa
2022-Jun-22 17:25 UTC
[R] Back transform confidence intervals sjplot (plot_model)
Hello all! I am having two isues with the sjplot package, When dealing with my data I have the following issue: Original data: https://docs.google.com/spreadsheets/d/1hoOfh78Ev03amXYwNxlWpwbdr1GcDtL_QBiErwxcJds/edit?usp=sharing library(ggplot2) library(geepack) library(sjPlot) dat2<-read.delim("clipboard") dat$IDN=as.factor(dat$IDN) attach(dat2) m11 <- geeglm( formula = log(Timmo)~ presa+picaduras, data = dat2, id = IDN, corstr = "exchangeable" ) plot_model(m11, type = "pred", terms = c("picaduras", "presa")) When plotting the data I get this error: # Model has log-transformed response. Back-transforming predictions to original response scale. Standard errors are still on the log-scale My question is, is it possible to back transform confidence intervals for using the plot_model argument? An additional question I have is how to define manually the color scale and order the factors using sjplot. Thanks for sharing this package, it is awesome! Many thanks [[alternative HTML version deleted]]
Ebert,Timothy Aaron
2022-Jun-23 14:00 UTC
[R] Back transform confidence intervals sjplot (plot_model)
Can one back transform confidence intervals: yes, just like one back transforms other values. Should one back transform confidence intervals: probably not. Even if you applied the log transformation because it fixed problems in the model residuals, it is possible (likely?) that the reason that transformation worked was because the model was more appropriate for describing the relationship between the variables and that relationship was not a straight line. A log transform is one way to model a curved line. People like seeing the original units. I might plot on log scale where I can include the original units. I might make two plots, one on log scale with stats and one on raw data for the stake holders. I might plot log transformed data and then annotate the axis to include back transformed values. I might plot the raw data and put in the equations for transformed data with a clear note that the analysis was on log transformed data. If none of this works I would try a nonlinear model. Maybe consider what you hope the audience will get out of the graphic. Is the audience trying to understand mechanisms and the strength of relationships or is the audience trying to relate your results to their situation. Tim -----Original Message----- From: R-help <r-help-bounces at r-project.org> On Behalf Of Luis Fernando Garc?a Sent: Wednesday, June 22, 2022 1:26 PM To: r-help mailing list <r-help at r-project.org> Subject: [R] Back transform confidence intervals sjplot (plot_model) [External Email] Hello all! I am having two isues with the sjplot package, When dealing with my data I have the following issue: Original data: https://urldefense.proofpoint.com/v2/url?u=https-3A__docs.google.com_spreadsheets_d_1hoOfh78Ev03amXYwNxlWpwbdr1GcDtL-5FQBiErwxcJds_edit-3Fusp-3Dsharing&d=DwICAg&c=sJ6xIWYx-zLMB3EPkvcnVg&r=9PEhQh2kVeAsRzsn7AkP-g&m=Ji4JGk_lU6Z1gVOt1aab4aejwbLV6FLxEQcFF48wWlQnbzZ8y9SZxAnP7oxFHD2S&s=cHngWhVUHi3c5fkYbep7Sw0DClls_2Svs4EedhA54es&elibrary(ggplot2) library(geepack) library(sjPlot) dat2<-read.delim("clipboard") dat$IDN=as.factor(dat$IDN) attach(dat2) m11 <- geeglm( formula = log(Timmo)~ presa+picaduras, data = dat2, id = IDN, corstr = "exchangeable" ) plot_model(m11, type = "pred", terms = c("picaduras", "presa")) When plotting the data I get this error: # Model has log-transformed response. Back-transforming predictions to original response scale. Standard errors are still on the log-scale My question is, is it possible to back transform confidence intervals for using the plot_model argument? An additional question I have is how to define manually the color scale and order the factors using sjplot. Thanks for sharing this package, it is awesome! Many thanks [[alternative HTML version deleted]] ______________________________________________ R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see https://urldefense.proofpoint.com/v2/url?u=https-3A__stat.ethz.ch_mailman_listinfo_r-2Dhelp&d=DwICAg&c=sJ6xIWYx-zLMB3EPkvcnVg&r=9PEhQh2kVeAsRzsn7AkP-g&m=Ji4JGk_lU6Z1gVOt1aab4aejwbLV6FLxEQcFF48wWlQnbzZ8y9SZxAnP7oxFHD2S&s=XGkUlsnTIyfXSpbRSTFMspRkle8X0rvFnx0BZ7AN5OI&ePLEASE do read the posting guide https://urldefense.proofpoint.com/v2/url?u=http-3A__www.R-2Dproject.org_posting-2Dguide.html&d=DwICAg&c=sJ6xIWYx-zLMB3EPkvcnVg&r=9PEhQh2kVeAsRzsn7AkP-g&m=Ji4JGk_lU6Z1gVOt1aab4aejwbLV6FLxEQcFF48wWlQnbzZ8y9SZxAnP7oxFHD2S&s=Cx3FIscbDuqRLhHEzEtXW7kiAVhp_ESUqXiXZC2_jJY&eand provide commented, minimal, self-contained, reproducible code.