[R] Interactions in regression

Bert Gunter bgunter@4567 @end|ng |rom gm@||@com
Sun Feb 25 17:00:10 CET 2024


It is trivial in R to add whatever decorations to a plot that you would
like, but that requires that you go beyond point and click production of
graphics and write actual code. If you are unwilling or unable to do this,
you are stuck with whatever various packaged graphics functionality
provides.So you might want to search on "interaction plots for linear
models in R" or similar at rseek.org or in your favorite web search engine
if you haven't already done so. My minimal efforts brought up lots of hits,
though none may be useful for your concerns, especially, as has already
been pointed out, as your query doesn't seem to make much sense
statistically.

Cheers,
Bert


On Sun, Feb 25, 2024 at 7:46 AM Jacek Kownacki <samsungx1298 using gmail.com>
wrote:

> Hi All,
> I stumbled upon some topics regarding interactions in anova and regression
> and packages for tabulating and visualizations the results of them.
> Here we are:
>
> https://stackoverflow.com/questions/77933272/how-to-add-a-reference-level-for-interaction-in-gtsummary-and-sjplot/77935742#77935742
> ,
>
> https://stackoverflow.com/questions/78016795/how-to-add-reference-levels-for-interaction-in-r?noredirect=1&lq=1
> .
> I was wondering because I usually use GUI software and these questions did
> not get answers, if from a technical point of view
> how to do it, using these (sjPlot, gtsummary) or other ways to make such
> tables, inserting the reference levels of these mentioned interactions.
> This is not likely to be used in publications (including three base
> levels), but from the point of view of solving the topics this questions
> have interested me.
> I tried myself to make it happen, but so far without success.
> I recall this reprex based on SO:
>
> set.seed(1000)
> my_data <- rbind(
>   data.frame(time = "Pre", treatment = "Control", response =
> rnorm(100, mean=1)),
>   data.frame(time = "Pre", treatment = "Treatment", response =
> rnorm(100, mean=2)),
>   data.frame(time = "Post", treatment = "Control", response =
> rnorm(100, mean=1)),
>   data.frame(time = "Post", treatment = "Treatment", response =
> rnorm(100, mean=2))
> ) %>% mutate(time = factor(time, levels = c("Pre", "Post")))
> %>%mutate(treatment = factor(treatment, levels = c("Control",
> "Treatment")))
> model3 <- lm(response ~ time * treatment, data = my_data)
>
> Thanks,
> Jacek
>
>         [[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