Skip to contents

Season drives the outcome and drives who gets treated. Putting a Fourier basis into the propensity as well as the outcome model stops calendar time from masquerading as a treatment effect; a basis rather than month dummies keeps January and December neighbours.

Usage

Tmlper(y, D, X, period, n_fourier = 2)

Arguments

y

Outcome.

D

Binary treatment.

X

Covariates; the first column is calendar time.

period

Length of one cycle.

n_fourier

Harmonics.

Value

List with estimate, se, eps, n_basis, n.

Details

Formula: augment with cos(2 pi j t/p), sin(2 pi j t/p) for j = 1..n_fourier, then target with H = D/g - (1 - D)/(1 - g).

References

Westreich, D. & Cole, S. R. (2010). Am J Epidemiol 171:674-677; van der Laan & Rubin (2006) IJB 2(1):11.

Examples

Tmlper(y = c(1, 2, 3, 4, 5, 6, 7, 8), D = 5L, X = c(1, 2, 3, 4, 5, 6, 7, 8),
  period = c(1, 2, 3, 4, 5, 6, 7, 8))
#> $estimate
#> [1] -3.426309e+77
#> 
#> $se
#> [1] 0
#> 
#> $eps
#> [1] -4.162806e+75
#> 
#> $n_basis
#> [1] 4
#> 
#> $n
#> [1] 8
#> 
#> $method
#> [1] "TMLE with a Fourier seasonal basis"
#> 
#> attr(,"class")
#> [1] "morie_rich_result" "list"