tidy_eventcoef: Tidy lead/lag coefficients to data frame

Description Usage Arguments Details Value See Also Examples

View source: R/tidy_eventcoef.R

Description

Tidy lead/lag coefficients to data frame

Usage

1
tidy_eventcoef(model, varname, baseline = NA, ...)

Arguments

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 tidy(), e.g. conf.int=TRUE

Details

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).

Value

A subset of the data frame as returned by tidy with the estimates for the leads and lags and a variable eventtime.

See Also

tidy

Examples

 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))

sumtxt/dd documentation built on Jan. 3, 2021, 12:39 a.m.