wass_regress {WRI}R Documentation

Perform Frechet Regression with the Wasserstein Distance

Description

Perform Frechet Regression with the Wasserstein Distance

Usage

wass_regress(rightside_formula, Xfit_df, Ytype, Ymat, Sup = NULL)

Arguments

rightside_formula

a right-side formula

Xfit_df

n-by-p matrix (or dataframe) of predictor values for fitting (do not include a column for the intercept)

Ytype

'quantile' or 'density'

Ymat

one of the following matrices:

  • if Ytype = 'quantile' Ymat is an n-by-m matrix of the observed quantile functions. Ymat[i, :] is a 1-by-m vector of quantile function values on grid Sup.

  • if Ytype = 'density' Ymat is an n-by-m matrix of the observed density functions. Ymat[i, :] is a 1-by-m vector of density function values on grid Sup.

Sup

one of the following vectors:

  • if Ytype = 'quantile' Sup is a length m vector - common grid for all quantile functions in Ymat (default: seq(0, 1, length.out = ncol(Ymat))).

  • if Ytype = 'density' Sup is a length m vector - common grid for all density functions in Ymat (default: seq(0, 1, length.out = ncol(Ymat))).

Value

a list containing the following objects:

call

function call

rformula

rightside_formula

predictor_names

names of predictors as the colnames given in the xfit matrix or dataframe.

Qfit

n-by-m matrix of fitted quantile functions.

xfit

design matrix in quantile fitting.

Xfit_df

n-by-p matrix (or dataframe) of predictor values for fitting

Yobs

a list containing the following matrices:

  • Qobs: n-by-m matrix of the observed quantile functions.

  • qobs: n-by-m matrix of the observed quantile density functions.

  • qobs_prime: n-by-m matrix of the first derivative of the observed quantile density functions.

  • fobs: n-by-m matrix of the observed density functions.

t_vec

a length m vector - common grid for all quantile functions in Qobs.

References

Wasserstein F-tests and confidence bands for the Frechet regression of density response curves, Alexander Petersen, Xi Liu and Afshin A. Divani, 2019

Examples

data(strokeCTdensity)
predictor = strokeCTdensity$predictors
dSup = strokeCTdensity$densitySupport
densityCurves = strokeCTdensity$densityCurve

res1 = wass_regress(rightside_formula = ~., Xfit_df = predictor,
 Ytype = 'density', Ymat = densityCurves, Sup = dSup)
res2 = wass_regress(rightside_formula = ~ log_b_vol * weight, Xfit_df = predictor,
 Ytype = 'density', Ymat = densityCurves, Sup = dSup)

[Package WRI version 0.2.0 Index]