Type: | Package |
Title: | Calculates Critical Test Statistics to Control False Discovery Rates in Marginal Effects Plots |
Version: | 1.2 |
Date: | 2019-6-6 |
Author: | Justin Esarey and Jane Lawrence Sumner |
Maintainer: | Justin Esarey <justin@justinesarey.com> |
Description: | Implements the procedures suggested in Esarey and Sumner (2017) http://justinesarey.com/interaction-overconfidence.pdf for controlling the false discovery rate when constructing marginal effects plots for models with interaction terms. |
Depends: | stats, R (≥ 3.4) |
License: | GPL-2 | GPL-3 [expanded from: GPL] |
LazyData: | true |
RoxygenNote: | 6.1.1 |
Encoding: | UTF-8 |
NeedsCompilation: | no |
Packaged: | 2019-06-06 19:47:51 UTC; justi |
Repository: | CRAN |
Date/Publication: | 2019-06-06 21:00:03 UTC |
Bootstrapping t-statistics
Description
This function is defunct.
Usage
bootFun(...)
Arguments
... |
Any argument to the function (ignored). |
References
Esarey, Justin, and Jane Lawrence Sumner. 2018. "Corrigendum to 'Marginal Effects in Interaction Models: Determining and Controlling the False Positive Rate.'"
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, type = "BH", 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. |
type |
Should the BH (Benjamini and Hochberg 1999) or BY (Benjamini and Yekutieli 2000) correction be used? Options are "BH" (the default) or "BY". |
level |
The level of confidence. Defaults to 0.95. |
Value
The critical t-statistic for the interaction.
Author(s)
Justin Esarey and Jane Lawrence Sumner
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.
Benjamini, Yoav, and Daniel Yekutieli. 2001. "The Control of the False Discovery Rate in Multiple Testing Under Dependency." The Annals of Statistics 29(4): 1165-1188.
Clark, William R., and Matt Golder. 2006. "Rehabilitating Duverger's Theory." Comparative Political Studies 39(6): 679-708.
Esarey, Justin, and Jane Lawrence Sumner. 2017. "Marginal Effects in Interaction Models: Determining and Controlling the False Positive Rate." Comparative Political Studies 51(9): 1144-1176.
Esarey, Justin, and Jane Lawrence Sumner. 2018. "Corrigendum to 'Marginal Effects in Interaction Models: Determining and Controlling the False Positive Rate.'"
Examples
## 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)
Determine Critical t-Statistic For Marginal Effects Plot
Description
This function is defunct.
Usage
findMultiLims(...)
Arguments
... |
Any argument to the function (ignored). |
References
Esarey, Justin, and Jane Lawrence Sumner. 2018. "Corrigendum to 'Marginal Effects in Interaction Models: Determining and Controlling the False Positive Rate.'"
Replication data for Clark and Golder (2006)
Description
District magnitude and ethnic heterogeneity data from a pooled sample of established democracies in the 1990s. Data originally from Clark and Golder (2006).
Format
A data frame with 754 rows and 33 variables:
- country
country name
- countrynumber
country number
- year
year of observation
- enep1
electoral parties
- eneg
ethnic heterogeneity
- logmag
district magnitude
- legelec
legislative election
- preselec
presidential election
- regime
regime as of 31 Dec of given year (0=democracy, 1=dictatorship)
- regime_leg
regime type at time of leg. election (0=democracy, 1=dictatorship)
- eighties
election in 1980s closest to 1985
- nineties
election in 1990s closest to 1995
- old
elections in countries that did not transition to democracy in 1990s
- avemag
average district magnitude
- districts
number of electoral districts
- enep
effective number of ethnic groups fearon
- enep_others
n/a
- enpp
parliamentary parties - uncorrected
- enpp_others
n/a
- enpp1
parliamentary parties - corrected
- enpres
effective number of presidential candidates
- medmag
median district magnitude
- newdem
first election of new democracy
- proximity1
proximity - continuous
- proximity2
proximity - dichotomous
- seats
assembly size
- upperseats
number of upper tier seats
- uppertier
percentage of uppertier seats
- uppertier_eneg
uppertier*eneg
- logmag_eneg
logmag*eneg
- proximity1_enpres
proximity1*enpres
- twoelections
n/a
- twoelections1
n/a
...
Source
Clark, William R., and Matt Golder. 2006. "Rehabilitating Duverger's Theory." Comparative Political Studies 39(6): 679-708.