Description Usage Arguments Details Value See Also Examples
View source: R/tidy_eventcoef.R
Tidy lead/lag coefficients to data frame
1 | tidy_eventcoef(model, varname, baseline = NA, ...)
|
model |
fitted model object |
varname |
quoted (partial) name of the time-to-event variable |
baseline |
optional reference period to add (see details) |
... |
further parameters passed to |
The function extracts the coefficients using tidy
and
then subsets to the relevant coefficients based on varname
.
The parameter baseline
allows to add an estimate
with value zero and with a confidence interval of length zero to
visually highlight the reference period for the leads and lags.
All additional arguments are passed further to
tidy
. This can be a global argument
(e.g., conf.int=TRUE
) or extractor-specific
argument (e.g., se.type='robust'
) when
using felm
for fitting (see tidy.felm
).
A subset of the data frame as returned by tidy
with the estimates for the leads and lags and a variable eventtime
.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 | library(dd)
data(goldendawn)
goldendawn$ttime <- code_eventtime(
unit=muni,
time=year,
treat=post,
data=goldendawn)
m <- lm(gd ~ ttime + factor(muni) + factor(year), data=goldendawn)
summary(m)
toplot <- tidy_eventcoef(m, varname='ttime', conf.int=TRUE)
with(toplot, plot(eventtime,estimate, pch=20, ylim=c(-2,3)))
with(toplot, segments(eventtime,conf.low, eventtime, conf.high))
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.