*! version 1.0 2/27/2018

Title

effdisp -- creates plots of an interaction effect showing how the effect of a designated focal variable changes with its moderator(s).

Description

effdisp produces line plots, drop line plots, error bar plots or contour plots displaying the focal variable's effect on the observed or
"modeled" outcome as it varies with the values of its moderator(s). Line plots and contour plots can optionally show where the moderated effect
of the focal variable is and is not significant. Must run intspec before running effdisp. See Kaufman (2018) for detailed
explanation and step-by-step examples of using this and other ICALC add-on commands.

Syntax

effdisp , [ plot(type(plottype) name(graphname) keep save(filepath)
freq(base)) effect(type(suboptions)) cilev(#, adjtype) ndigits(#)
pltopts(string) sigmark ccuts(numlist) heatmap ]

options Description

plot(type(plottype) suboptions) specifies how to plot focal variable’s effect varying with moderator(s)

type(plottype) plottype is keyword for type of plot

cbound for a confidence bounds plot, default if interval 1st moderator

errbar for an error bar plot, default if categorical 1st moderator

line for a connected line plot, interval 1st moderator

drop for a drop line plot, usually categorical 1st moderator

contour for contour plot, only if interval 1st & 2nd moderators

suboptions

name(graphname) save plot as memory graph with name graphname

keep save any intermediate graphs used to create final graph

save(filepath) save the plotting data & frequency distribution to Excel file with name & location given by filepath

freq(base) add relative frequency distribution of 1st moderating variable or 1st by 2nd moderator to the plot

base can be

tot for distribution of 1st moderator

sub for distribution of the 1st moderator within levels of the 2nd

subtot for joint distribution of the 1st & 2nd moderators relative to total sample size

effect(type(suboptions)) Type of coefficient value reported in significance region table for delta unit change in focal variable

type Keyword for coefficient type

b for estimated coefficient

factor for factor change coefficient

spost for marginal/discrete change calculated by the SPOST13 mchange command

Default is effect(b).

suboptions b(delta) or factor(delta) where delta is

1 for 1 unit change. Default

sd for 1 standard deviation change

# any non-zero real number change

sdy for estimated effect scaled in standard deviation units of "modeled" outcome

sdyx for sdy effect calculated for a 1 standard deviation change in focal variable

Default is delta of 1.

suboptions spost(amtopt( ) atopt( )) where

amtopt( ) specifies amount-of-change options for SPOST13 mchange command ((see Long and Freese 2014).
Must include amount( ) with a single entry. Default amtopt(amount(one)).

atopt( )specifies content for the at( ) option of the margins command for predictors other than focal or moderators.
Default is atopt((asobs) _all)

cilev(#, adjtype) # is confidence interval level (.95 for a 95% CI)

adjtype is bonferroni, sidak or potthoff adjustment for multiple tests, can specify potthoff in combination with
either bonferroni or sidak. Can abbreivate to 1st three letters. Default ci(.95)

ndigits(#) number of digits for y-axis labels Default = 4.

sigmark if sigmark keyword present, add visual displays to denote significant and non-significant effects on line,
drop line or contour plots

pltopts(string) string contains two-way graph options to customize appearance (e.g. line colors). These do not always work as expected.
Use the graph editor if not.

Contour plot only options

ccuts(numlist) numlist defines contour cutpoints. Default is 6 equal steps from min to max of moderated effect.

heatmap Stata twoway contour option for how similar height areas are portrayed

Note: Moderator range( ) specifications define display values/labels on axis plotting 1st moderator
(contour plots: also 2nd moderator). For additional moderators defines calculation points at which the plot is repeated.

Example: two-way interaction

For a model predicting poor mental health days (pmhdays) by the interaction of work-family conflict (wfconflict)
and job status (sei), intspec specfies wfconflict as the focal variable and sei as its moderator. effdisp
produces a confidence bounds plot of wfconflict's effect on pmhdays as it changes with sei, the default plot type.

nbreg pmhdays c.wfconflict##c.sei ...

intspec, focal(c.wfconlifct) main( (c.sei name(JobStatus) range(17(10)97)) (c.wfconflict name(WorkFamConflict) range(1/4))) int2vars(c.wfconflict#c.sei)

effdisp , plot(type(cbound)) ndigits(2)

*** Add frequency distribution of sei to plot

effdisp , plot(type(cbound) freq(tot)) ndigits(2)

*** Change plot type to error bar

effdisp , ndigits(2) plot(type(errbar) freq(tot))

Example 2: three-way interaction

After a model predicting voluntary association memberships (memnum) which includes the interaction of age, educ (education) and female,
intspec specfies female as the focal, age as the 1st moderator and educ as the 2nd moderator. effdisp
produces a confidence bounds plot of female's effect on memnum as it changes with age, with a separate plot for each
of the five display values for education (0,5,10,15,20).

reg memnum i.female##c.age##c.educ ...

intspec, focal(i.female) main( (c.age, name(Age) range(18(10)88)) (c.educ, name(Education) range(0(5)20)) (i.female, name(Sex) range(0/1)) )
int2vars( c.age#i.female c.ed#i.female c.age#c.ed ) int3vars(i.female#c.age#c.ed) dvname(Memberships) ndig(0)

effdisp , ndig(2) plot(type(cbound))

*** Change plot type to contour

effdisp , ndig(2) plot(type(contour))

Author and Citation

I would appreciate users of this and other ICALC commands citing

Robert L. Kaufman. 2018. Interaction Effects in Linear and Generalized Linear Models, Sage Publcations.