jacob-long / jacob-long/interactions

Change Confidence Interval in interact_plot

Open
#73 1 comment 0 reactions 0 assignees View on GitHub
bug
Dominant language
R
Stars
135
Forks
19
PR merge metrics
No merged PRs in 30d

Description

I am using interact_plot to create interaction plots and want to change the size of the confidence interval. However, int.width is not changing the width of the confidence intervals. The images below show what is happening.

Looking below, we can see how the graph looks with int.width = 0.95
![image](https://github.com/jacob-long/interactions/assets/80338305/1731ad38-9082-4328-bb8e-0fd481cf309a)

In the next image, we can see when I set the int.width = 0.4
![image](https://github.com/jacob-long/interactions/assets/80338305/13cf7548-c647-4f72-b335-27d488900da0)

In addition, here is the code used to create the graphs in the images.
```r
# create the model object
model <- lm(mpg ~ cyl * hp, data = mtcars)

# create the interaction plot used in the first image, 95% confidence interval
interact_plot(model, pred = cyl, modx = hp, interval = TRUE, int.width = 0.95)

# create the interaction plot used in the second image, 40% confidence interval
interact_plot(model, pred = cyl, modx = hp, interval = TRUE, int.width = 0.4)
```

Contributor guide

No contributing guide indexed for this repository

Research direction

Start by running the supplied R examples with interact_plot and compare how int.width is handled for the two confidence intervals. Trace the interact_plot entry point and its interval calculation, then add a regression test showing that 0.95 and 0.4 produce different interval widths.

Written by the indexing model from the issue text.

Assessment

Tech stack
r
Domain
data-visualization
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.