its_llm: Estimates via Local Linear Regression with user-selected...

Description Usage Arguments Details Value See Also Examples

Description

its_llm estimates the intercept shift of a time series at a cut-point.

Usage

1
2
its_llm(df, rvar, outcome, trend = "none", bw = Inf, donut = 0,
  verbose = 0)

Arguments

df

(required) data.frame containing all variables

rvar

(required) the name of the running variable in df

outcome

(required) the name of the outcome variable in df

trend

include a linear term ('lin'), a quadratic term ('quad') or no trend at all ('none')?

bw

either a scalar or a vector of length 2 defining the bandwidth to the left (right) of the cut-point on the scale of rvar

donut

either a scalar or a vector of length 2 defining the length of the period to the left (right) of the cut-point for which the data are dropped (on the scale of rvar).

verbose

set to any value other than zero to show which data points are included in the estimation

Details

Estimates the size of the intercept shift of a time series at at cut-point (at zero) using a linear regression model with separate trends for the running variable to both sides of the cut-point and within the neighborhood as defined by the bandwidth parameters (bwL,bwR). Standard errors are calculated based on the heteroskedasticity-consistent covariance matrix (HC3) from the sandwich package.

Use its_plot_samples to understand which data points are included when choosing different values for bwL, bwR and donut.

When no values for trend, bwL, bwR and donut are supplied, the functions defaults to estimating the difference in means pooling all available data to the left/right of the cut-point.

Value

data.frame with a single row and entries for the point estimate (est), 95% confidence interval (lo,hi), standard error (se), p-value (pval) and the number of data points to the left/right of the cut-point used in the estimation (Nleft,Nright).

See Also

its_plot_samples, its_llm_placebo.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
## Not run: 
	
  N <- 21
  time <- seq(-1,1,length.out=N)
  treat <- as.numeric(time >= 0)
  y <- 1 + time + treat*1 + rnorm(N,0,0.25)
  df <- data.frame(y=y, time=time)
  its_llm(df, rvar="time", outcome="y", bw=0.25)


## End(Not run)

sumtxt/itstools documentation built on May 30, 2019, 8:38 p.m.