Conduct a floodlight analysis for 2 x Continuous design.
floodlight_2_by_continuous(
data = NULL,
iv_name = NULL,
dv_name = NULL,
mod_name = NULL,
covariate_name = NULL,
interaction_p_include = TRUE,
iv_level_order = NULL,
output = "reg_lines_plot",
jitter_x_percent = 0,
jitter_y_percent = 0,
dot_alpha = 0.5,
dot_size = 4,
interaction_p_value_font_size = 6,
jn_point_font_size = 6,
jn_point_label_hjust = NULL,
plot_margin = ggplot2::unit(c(60, 7, 7, 7), "pt"),
legend_position = "right",
reg_line_types = c("solid", "dashed"),
jn_line_types = c("solid", "solid"),
sig_region_color = "green",
sig_region_alpha = 0.08,
nonsig_region_color = "gray",
nonsig_region_alpha = 0.08,
x_axis_title = NULL,
y_axis_title = NULL,
legend_title = NULL,
round_decimals_int_p_value = 3,
line_of_fit_size = 1,
round_jn_point_labels = 2
)
a data object (a data frame or a data.table)
name of the binary independent variable
name of the dependent variable
name of the continuous moderator variable
name of the variables to control for
logical. Should the plot include a p-value for the interaction term?
order of levels in the independent
variable for legend. By default, it will be set as levels of the
independent variable ordered using R's base function sort
.
type of output (default = "reg_lines_plot").
horizontally jitter dots by a percentage of the range of x values
vertically jitter dots by a percentage of the range of y values#'
opacity of the dots (0 = completely transparent,
1 = completely opaque). By default, dot_alpha = 0.5
size of the dots (default = 4)
font size for the interaction p value (default = 6)
font size for Johnson-Neyman point labels (default = 6)
a vector of hjust values for Johnson-Neyman point labels. By default, the hjust value will be 0.5 for all the points.
margin for the plot
By default plot_margin = ggplot2::unit(c(60, 7, 7, 7), "pt")
position of the legend (default = "right").
If legend_position = "none"
, the legend will be removed.
types of the regression lines for the two levels
of the independent variable.
By default, reg_line_types = c("solid", "dashed")
types of the lines for Johnson-Neyman points.
By default, jn_line_types = c("solid", "solid")
color of the significant region, i.e., range(s) of the moderator variable for which simple effect of the independent variable on the dependent variable is statistically significant.
opacity for sig_region_color
.
(0 = completely transparent, 1 = completely opaque).
By default, sig_region_alpha = 0.08
color of the non-significant region, i.e., range(s) of the moderator variable for which simple effect of the independent variable on the dependent variable is not statistically significant.
opacity for nonsig_region_color
.
(0 = completely transparent, 1 = completely opaque).
By default, nonsig_region_alpha = 0.08
title of the x axis. By default, it will be set
as input for mod_name
. If x_axis_title = FALSE
, it will
be removed.
title of the y axis. By default, it will be set
as input for dv_name
. If y_axis_title = FALSE
, it will
be removed.
title of the legend. By default, it will be set
as input for iv_name
. If legend_title = FALSE
, it will
be removed.
To how many digits after the decimal point should the p value for the interaction term be rounded? (default = 3)
thickness of the lines of fit (default = 1)
To how many digits after the decimal point should the jn point labels be rounded? (default = 2)
The following package(s) must be installed prior to running this function: Package 'interactions' v1.1.1 (or possibly a higher version) by Jacob A. Long (2020), https://cran.r-project.org/package=interactions See the following references Spiller et al. (2013) doi:10.1509/jmr.12.0420. Kim (2021) tools:::Rd_expr_doi("10.5281/zenodo.4445388")
# \donttest{
floodlight_2_by_continuous(
data = mtcars,
iv_name = "am",
dv_name = "mpg",
mod_name = "qsec")
# add covariates
floodlight_2_by_continuous(
data = mtcars,
iv_name = "am",
dv_name = "mpg",
mod_name = "qsec",
covariate_name = c("cyl", "hp"))
# }
Run the code above in your browser using DataLab