Tilted (self-censoring-adjusted) within-person VAR(1) at a fixed value of the sensitivity parameter
Source:R/fit_tilt.R
fit_tilt.RdSensitivity analysis for motif M2 (self-censoring). The selection model \(P(R_t = 1 \mid X_t = x) = \Phi_N(\alpha + \delta' x)\) is held at a fixed sensitivity vector \(\delta\) that is never estimated from the fit. The response intercept is calibrated so that the model-implied response rate given the observed history matches the observed one, and complete pairs are reweighted by \(w_t = P(R_t = 1 \mid x_{t-1}) / P(R_t = 1 \mid x_t)\) (inverse-probability weighting with a stabilized numerator). Weighted within-person regression and intercept calibration are iterated to a fixed point; the population parameters are a fixed point when \(\delta\) is the true selection vector.
Usage
fit_tilt(
data,
vars,
delta,
id = "id",
time = "time",
day = NULL,
R = "R",
propensity = c("common", "person"),
pairs = NULL,
probe = NULL,
max_iter = 200L,
tol = 1e-05,
start = NULL,
damping = 0.5,
min_pairs = 5L
)Arguments
- data
Long data frame with one row per scheduled prompt.
- vars
Names of the state columns.
- delta
The sensitivity parameter: a numeric vector (length = number of variables) of selection coefficients in probit units per unit of the state; a scalar is applied to the first variable. Negative values encode "high states are skipped".
- id, time
Names of the person and prompt-index columns.
- day
Optional name of a day column; pairs are formed only within a day (the overnight gap is not a lag-1 transition).
- R
Name of the response-indicator column (0/1, no
NA). If the default name is not among the columns ofdata, a prompt counts as answered when allvarsare non-missing; any other name must exist.- propensity
"common"(one intercept) or"person"(one intercept per person; use when a person-propensity motif M4 is declared together with M2).- pairs
Optional precomputed result of
make_pairs.- probe
Optional name of a randomized-probe indicator column; probe prompts are answered by design, receive weight one and are excluded from the intercept calibration.
- max_iter, tol
Fixed-point iteration control.
- start
Optional
pairs_fit(typically the fit at a neighboring sensitivity value) used as the starting point of the iteration.- damping
Step size of the damped fixed-point update (1 = undamped).
- min_pairs
Passed to
fit_pairs.
Value
An object of class c("tilt_fit", "pairs_fit"): a
fit_pairs object with additional elements delta,
alpha (calibrated intercept(s)), iterations,
converged, weights, max_weight, propensity,
and ess, the effective number of complete pairs \((\sum w)^2 / \sum w^2\) (Kish).
The weights are not truncated: profiles in which ess falls far
below the number of pairs, or in which a few pairs carry very large
weights, rest on few observations and should be read with caution. The
cluster-robust covariance treats the weights as fixed (the uncertainty of
the calibrated intercept and of the parameters entering the weights is
not propagated).
See also
tilt_profile fits a grid of sensitivity values;
calibrate_delta chooses one from a design feature.
Examples
sim <- simulate_ema(N = 40, n_prompts = 30, motifs = "M2", delta = -1, seed = 1)
f0 <- fit_pairs(sim$data, sim$vars) # treats skips as ignorable
f <- fit_tilt(sim$data, sim$vars, delta = -1)
f
#> Within-person VAR(1) from 709 complete adjacent pairs, 40 persons (half-panel jackknife)
#> Lagged coefficients Phi (rows = outcome at t, columns = predictor at t-1):
#> NegA PosA Stress Fatigue
#> NegA 0.300 -0.022 0.271 -0.058
#> PosA -0.084 0.433 -0.050 0.113
#> Stress 0.106 -0.049 0.474 0.133
#> Fatigue 0.030 -0.133 -0.017 0.307
#> Contemporaneous partial correlations (innovations):
#> NegA PosA Stress Fatigue
#> NegA 1.000 -0.423 0.311 0.023
#> PosA -0.423 1.000 0.095 0.002
#> Stress 0.311 0.095 1.000 0.186
#> Fatigue 0.023 0.002 0.186 1.000
#> Between-person means (dynamics-recovered): 2.369 3.833 2.849 2.991
f$ess / f$n_pairs # effective share of pairs
#> [1] 0.9331293
c(untilted = f0$Phi[1, 1], tilted = f$Phi[1, 1], truth = default_params()$Phi[1, 1])
#> untilted tilted truth
#> 0.272030 0.299884 0.400000
# person-specific response intercepts (motif M4 declared with M2)
fp <- fit_tilt(sim$data, sim$vars, delta = -1, propensity = "person")
summary(fp$alpha)
#> Min. 1st Qu. Median Mean 3rd Qu. Max.
#> 2.524 3.271 3.563 3.573 3.924 4.399