get_lagYi: get_lagYi

View source: R/BMisc.R

get_lagYiR Documentation

get_lagYi

Description

A function that calculates lagged outcomes in a panel data setting. If the data.frame that is passed in has nxT rows, the resulting vector will also have nxT elements with one element for each unit set to be NA

Usage

get_lagYi(df, idname, yname, tname, nlags = 1)

Arguments

df

the data.frame used in the function

idname

name of column that holds the unit id

yname

name of column containing the outcome (or other variable) for which to calculate its outcome in the immediate pre-treatment period

tname

name of column that holds the time period

nlags

The number of periods to lag. The default is 1, which computes the lag from the previous period.


bcallaway11/BMisc documentation built on March 13, 2024, 1:39 a.m.