spotlight_2_by_continuous {kim} | R Documentation |
Spotlight 2 by Continuous
Description
Conduct a spotlight analysis for a 2 x Continuous design. See Spiller et al. (2013) doi:10.1509/jmr.12.0420
Usage
spotlight_2_by_continuous(
data = NULL,
iv_name = NULL,
dv_name = NULL,
mod_name = NULL,
logistic = NULL,
covariate_name = NULL,
focal_values = NULL,
interaction_p_include = TRUE,
iv_level_order = NULL,
output_type = "plot",
colors = c("red", "blue"),
dot_size = 3,
observed_dots = FALSE,
reg_lines = FALSE,
reg_line_width = 1,
reg_line_size = 1,
lines_connecting_est_dv = TRUE,
lines_connecting_est_dv_width = 1,
estimated_dv_dot_shape = 15,
estimated_dv_dot_size = 6,
error_bar = "ci",
error_bar_range = 0.95,
error_bar_tip_width = NULL,
error_bar_tip_width_percent = 8,
error_bar_thickness = 1,
error_bar_offset = NULL,
error_bar_offset_percent = 8,
simp_eff_bracket_leg_ht = NULL,
simp_eff_bracket_leg_ht_perc = 2,
simp_eff_bracket_offset = NULL,
simp_eff_bracket_offset_perc = 1,
simp_eff_bracket_color = "black",
simp_eff_bracket_line_width = 1,
simp_eff_text_offset = NULL,
simp_eff_text_offset_percent = 7,
simp_eff_text_hjust = 0.5,
simp_eff_text_part_1 = "Simple Effect\n",
simp_eff_text_color = "black",
simp_eff_font_size = 5,
interaction_p_value_x = NULL,
interaction_p_value_y = NULL,
interaction_p_value_font_size = 6,
interaction_p_value_vjust = -1,
interaction_p_value_hjust = 0.5,
x_axis_breaks = NULL,
x_axis_limits = NULL,
x_axis_tick_mark_labels = NULL,
y_axis_breaks = NULL,
y_axis_limits = NULL,
x_axis_space_left_perc = 10,
x_axis_space_right_perc = 30,
y_axis_tick_mark_labels = NULL,
x_axis_title = NULL,
y_axis_title = NULL,
legend_title = NULL,
legend_position = "right",
y_axis_title_vjust = 0.85,
round_decimals_int_p_value = 3,
jitter_x_percent = 0,
jitter_y_percent = 0,
dot_alpha = 0.2,
reg_line_alpha = 0.5,
jn_point_font_size = 6,
reg_line_types = c("solid", "dashed"),
caption = NULL,
plot_margin = ggplot2::unit(c(60, 30, 7, 7), "pt"),
silent = FALSE
)
Arguments
data |
a data object (a data frame or a data.table) |
iv_name |
name of the binary independent variable (IV) |
dv_name |
name of the dependent variable (DV) |
mod_name |
name of the continuous moderator variable (MOD) |
logistic |
logical. Should logistic regressions be conducted, rather than ordinary least squares regressions? By default, ordinary least squares regressions will be conducted. |
covariate_name |
name(s) of the variable(s) to control for in estimating conditional values of the DV. |
focal_values |
focal values of the moderator variable at which to estimate IV's effect on DV. |
interaction_p_include |
logical. Should the plot include a p-value for the interaction term? |
iv_level_order |
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 |
output_type |
type of output (default = "plot"). Other possible values include "spotlight_results", "dt_for_plotting", "modified_dt" |
colors |
set colors for the two levels of the independent variable
By default, |
dot_size |
size of the observed_dots (default = 3) |
observed_dots |
logical. If |
reg_lines |
logical. If |
reg_line_width |
thickness of the regression lines (default = 1). |
reg_line_size |
deprecated. Use |
lines_connecting_est_dv |
logical. Should lines connecting the estimated values of DV be drawn? (default = TRUE) |
lines_connecting_est_dv_width |
thickness of the lines connecting the estimated values of DV (default = 1). |
estimated_dv_dot_shape |
ggplot value for shape of the dots at estimated values of DV (default = 15, a square shape). |
estimated_dv_dot_size |
size of the dots at estimated values of DV (default = 6). |
error_bar |
if |
error_bar_range |
width of the confidence interval
(default = 0.95 for a 95 percent confidence interval).
This argument will not apply when |
error_bar_tip_width |
graphically, width of the segments at the end of error bars (default = 0.13) |
error_bar_tip_width_percent |
(default) |
error_bar_thickness |
thickness of the error bars (default = 1) |
error_bar_offset |
(default) |
error_bar_offset_percent |
(default) |
simp_eff_bracket_leg_ht |
(default) |
simp_eff_bracket_leg_ht_perc |
(default) |
simp_eff_bracket_offset |
(default) |
simp_eff_bracket_offset_perc |
(default) |
simp_eff_bracket_color |
(default) |
simp_eff_bracket_line_width |
(default) |
simp_eff_text_offset |
(default) |
simp_eff_text_offset_percent |
(default) |
simp_eff_text_hjust |
(default) |
simp_eff_text_part_1 |
The first part of the text for
labeling simple effects.
By default, |
simp_eff_text_color |
color for the text indicating p-values of simple effects (default = "black"). |
simp_eff_font_size |
font size of the text indicating p-values of simple effects (default = 5). |
interaction_p_value_x |
(default) |
interaction_p_value_y |
(default) |
interaction_p_value_font_size |
font size for the interaction p value (default = 6) |
interaction_p_value_vjust |
(default) |
interaction_p_value_hjust |
(default) |
x_axis_breaks |
(default) |
x_axis_limits |
(default) |
x_axis_tick_mark_labels |
(default) |
y_axis_breaks |
(default) |
y_axis_limits |
(default) |
x_axis_space_left_perc |
(default) |
x_axis_space_right_perc |
(default) |
y_axis_tick_mark_labels |
(default) |
x_axis_title |
title of the x axis. By default, it will be set
as input for |
y_axis_title |
title of the y axis. By default, it will be set
as input for |
legend_title |
title of the legend. By default, it will be set
as input for |
legend_position |
position of the legend (default = "right").
If |
y_axis_title_vjust |
position of the y axis title (default = 0.85).
If default is used, |
round_decimals_int_p_value |
To how many digits after the decimal point should the p value for the interaction term be rounded? (default = 3) |
jitter_x_percent |
horizontally jitter dots by a percentage of the range of x values |
jitter_y_percent |
vertically jitter dots by a percentage of the range of y values |
dot_alpha |
opacity of the dots (0 = completely transparent,
1 = completely opaque). By default, |
reg_line_alpha |
(default) |
jn_point_font_size |
(default) |
reg_line_types |
types of the regression lines for the two levels
of the independent variable.
By default, |
caption |
(default) |
plot_margin |
margin for the plot
By default |
silent |
If |
Examples
spotlight_2_by_continuous(
data = mtcars,
iv_name = "am",
dv_name = "mpg",
mod_name = "qsec")
# control for variables
spotlight_2_by_continuous(
data = mtcars,
iv_name = "am",
dv_name = "mpg",
mod_name = "qsec",
covariate_name = c("cyl", "hp"))
# control for variables and adjust simple effect labels
spotlight_2_by_continuous(
data = mtcars,
iv_name = "am",
dv_name = "mpg",
mod_name = "qsec",
covariate_name = c("cyl", "hp"),
reg_lines = TRUE,
observed_dots = TRUE,
error_bar_offset_percent = 3,
error_bar_tip_width_percent = 3,
simp_eff_text_offset_percent = 3,
simp_eff_bracket_leg_ht_perc = 2,
dot_alpha = 0.2,
simp_eff_text_part_1 = "")
# spotlight at specific values
spotlight_2_by_continuous(
data = mtcars,
iv_name = "am",
dv_name = "mpg",
mod_name = "qsec",
covariate_name = c("cyl", "hp"),
focal_values = seq(15, 22, 1),
reg_lines = TRUE,
observed_dots = TRUE,
dot_alpha = 0.2,
simp_eff_text_part_1 = "",
simp_eff_font_size = 4,
error_bar_offset_percent = 3,
error_bar_tip_width_percent = 3,
simp_eff_text_offset_percent = 3,
simp_eff_bracket_leg_ht_perc = 1,
x_axis_breaks = seq(15, 22, 1))
# spotlight for logistic regression
spotlight_2_by_continuous(
data = mtcars,
iv_name = "am",
dv_name = "vs",
mod_name = "drat",
logistic = TRUE)