Learn R Programming

interactionTest (version 1.0)

fdrInteraction: Critical t-statistic

Description

This function calculates the critical t-statistic to limit the false discovery rate (Benjamini and Hochberg 1995) for a marginal effects plot to a specified level.

Usage

fdrInteraction(me.vec, me.sd.vec, df, level = 0.95)

Arguments

me.vec
A vector of marginal effects.
me.sd.vec
A vector of standard deviations for the marginal effects.
df
Degrees of freedom.
level
The level of confidence. Defaults to 0.95.

Value

The critical t-statistic for the interaction.

References

Benjamini, Yoav, and Yosef Hochberg. 1995. "Controlling the False Discovery Rate: A Practical and Powerful Approach to Multiple Testing." Journal of the Royal Statistical Society, Series B 57(1): 289-300.

Clark, William R., and Matt Golder. 2006. "Rehabilitating Duverger's Theory." Comparative Political Studies 39(6): 679-708.

Esarey, Justin, and Jane Lawrence Sumner. 2015. "Marginal Effects in Interaction Models: Determining and Controlling the False Positive Rate." URL: http://jee3.web.rice.edu/interaction-overconfidence.pdf.

Examples

Run this code
## Not run: 
# data(legfig)                # Clark and Golder 2006 replication data
# 
# # limit to established democracies from the 1990s
# dat<-subset(legfig, subset=(nineties==1 & old==1))
# 
# lin.mod <- lm(enep1 ~ eneg + logmag + logmag_eneg + uppertier_eneg + uppertier +
# proximity1 + proximity1_enpres + enpres, data=dat)
# 
# # save betas
# beta.mod <- coefficients(lin.mod)
# # save vcv
# vcv.mod <- vcov(lin.mod)
# 
# # calculate MEs
# mag <- seq(from=0.01, to=5, by=0.01)
# me.vec <- beta.mod[2] + beta.mod[4]*mag
# me.se <- sqrt( vcv.mod[2,2] + (mag^2)*vcv.mod[4,4] + 2*(mag)*(vcv.mod[2,4]) )
# 
# ci.hi <- me.vec + 1.697 * me.se
# ci.lo <- me.vec - 1.697 * me.se
# 
# plot(me.vec ~ mag, type="l", ylim = c(-4, 6))
# lines(ci.hi ~ mag, lty=2)
# lines(ci.lo ~ mag, lty=2)
# 
# fdrInteraction(me.vec, me.se, df=lin.mod$df, level=0.90)                  # 4.233986
# 
# ci.hi <- me.vec + 4.233986 * me.se
# ci.lo <- me.vec - 4.233986 * me.se
# 
# lines(ci.hi ~ mag, lty=2, lwd=2)
# lines(ci.lo ~ mag, lty=2, lwd=2)
# 
# abline(h=0, lty=1, col="gray")
# legend("topleft", lwd=c(1,2), lty=c(1,2), legend=c("90% CI", "90% FDR CI"))
# ## End(Not run)

Run the code above in your browser using DataLab