Learn R Programming

WRI

An R package for the paper “Wasserstein F-tests and confidence bands for the Frechet regression of density response curves”.

Installation

You can install the released version of WRI from CRAN with:

install.packages("WRI")

Example

This is a basic example which shows you how to solve a common problem:

library(WRI)
data(strokeCTdensity)
predictor = strokeCTdensity$predictors
dSup = strokeCTdensity$densitySupport
densityCurves = strokeCTdensity$densityCurve
xpred = predictor[3, ]

res = wass_regress(rightside_formula = ~., Xfit_df = predictor,
Ytype = 'density', Ymat = densityCurves, Sup = dSup)
# compute the density band for the third observation
confidence_Band1 = confidenceBands(res, Xpred_df = xpred, type = 'density')

Main components

  • strokeCTdensity: clinical, radiological scalar variables and density curves of the hematoma of 393 stroke patients
  • wass_regress: perform Frechet Regression with the Wasserstein Distance
  • wass_R2: compute Wasserstein coefficient of determination
  • globalFtest: perform global F test for Wasserstein regression
  • partialFtest: perform partial F test for Wasserstein regression
  • summary.WRI: provide summary information of Wasserstein regression
  • confidenceBands: compute intrinsic confidence bands and density bands

Copy Link

Version

Install

install.packages('WRI')

Monthly Downloads

249

Version

0.2.1

License

GPL-2

Maintainer

Xi Liu

Last Published

December 16th, 2025

Functions in WRI (0.2.1)

warSim

Generate simulation data
print.summary.WRI

print the summary of WRI object
quadraticQ

An internal function to do quadratic program in order to make Qfitted nondescreasing
globalFtest

global F test for Wasserstein regression
quan2den_qd

convert density function to quantile and quantile density function
partialFtest

partial F test for Wasserstein regression
WARp

WAR(p) models: estimation and forecast
WARp_forecast_tangent

Forecast using WAR(p) models
den2Q_qd

convert density function to quantile and quantile density function
confidenceBands

Confidence Bands for Wasserstein Regression
Sample_ACV

Function for calculating sample autocovariance
Exp_Map_Barycenter_Method

Numerical implementation of the Exponential map
Exp_Map_Barycenter_Method_pw

Numerical implementation of the pointwise Exponential map
WARp_acvfs

Function for calculating sample Wasserstein autocovariance functions
globalFstat

An internal function used in bootstrap global F test
summary.WRI

Summary Function of Wasserstein Regression Model
simulate_quantile_curves

Simulate quantile curves
strokeCTdensity

Stroke data: clinical, radiological scalar variables and density curves of the hematoma of 393 stroke patients
predict.WARp

Prediction by WAR(p) models
getInnovation

Calculating innovations in WAR(p) models
wass_R2

Compute Wasserstein Coefficient of Determination
wass_regress

Perform Frechet Regression with the Wasserstein Distance