Mirror Splits from Partial Dependence
pd_splits.RdFor ech split, we return an array of dimension n_taxa x 2 fits x n_lags. Each entry contains the estimated counterfactual effect for that taxon and lag combination across the two models (each fit on a different random sample of data).
Arguments
- ts
An object of class
ts_intercontaining the time-varying microbiome community, environmental interventions, and static host features data. The columns for each element of thevaluesmatrix are expected to be consecutive timepoints in an changing community.ts_from_dfs()is a helper to create these objects fromdata.frameswith the relevant information.- w0
One of the counterfactuals with which to compute partial dependence profiles. See
stepsorpulsesfor helpers in generating these counterfactuals. The procedure concatenates these counterfactuals to the end of the series and computes the difference in the forecasts.- w1
One of the counterfactuals with which to compute partial dependence profiles. See
stepsorpulsesfor helpers in generating these counterfactuals. The procedure concatenates these counterfactuals to the end of the series and computes the difference in the forecasts.- tr_fun
A function that can be used to train over random splits. In the examples in this package, we use an anonymous function that fills our chosen hyperparameters in
mbtransfer. For example\(x) mbtransfer(x, P = 1, Q = 1)will fit a lag-1 transfer function model on all the random splits.