WR | R Documentation |
Wasserstein regression with (1) distributional and/or scalar predictors and distributional responses, (2) distributional (and scalar) predictors and scalar responses.
WR(X, Y, qSup, optns = list(), FPCAoptnsX = list(), FPCAoptnsY = list())
X |
A list whose elements consist of distributional predictors and/or scalar predictors.
Each distributional predictor has to be represented by a |
Y |
Distributional or scalar responses.
A distributional response has to be represented by a |
qSup |
A vector of length |
optns |
A list of optional control parameters for regression specified by |
FPCAoptnsX , FPCAoptnsY |
Lists of optional control parameters for functional principal
component analysis (FPCA) of log mapped distributional predictors and responses, respectively.
See 'Details' of |
Available control options are
The projection method if the fitted values of log mapped distributional responses lie out of the log image space:
'log'
(the method as per Chen, Lin, and Müller, 2021);
'qt'
(default, the method as per Petersen & Müller, 2019).
A scalar specifying the lower bound of the support of responses if
they are distributional, only relevant if methodProj
is 'qt'
.
Default: NULL
, i.e., no finite lower bound.
A scalar specifying the upper bound of of the support of responses if
they are distributional, only relevant if methodProj
is 'qt'
.
Default: NULL
, i.e., no finite upper bound.
A list of the following:
Yfit |
Fitted responses; either a vector of length |
qSup |
The input |
beta |
A list of fitted coefficient functions,
|
workGridX |
A list of elements,
which are either vectors holding a working grid for elements of |
workGridY |
A vector holding a working grid for elements of |
fpcaLogX |
A list of FPCA objects holding the FPCA output for each log mapped distributional predictors;
Or |
fpcaLogY |
An FPCA object holding the FPCA output for log mapped responses if the responses are distributional;
|
X |
The input |
Y |
The input |
outOfLogSpace |
A logical vector holding whether initial fitted log mapped distributional responses
lie out of the log image space ( |
optns |
A list of options actually used. |
FPCAoptnsX |
A list of FPCA options actually used for distributional predictors;
|
FPCAoptnsY |
A list of FPCA options actually used for distributional responses;
|
Chen, Y., Lin, Z., & Müller, H.-G. (2021). "Wasserstein regression." Journal of the American Statistical Association, in press. Petersen, A., & Müller, H.-G. (2019). "Fréchet regression for random objects with Euclidean predictors." The Annals of Statistics, 47(2), 691–719.
# X = N( mu1, sigma1^2 ), Y = N( mu2, sigma2^2 )
# E( mu2 | mu1, sigma1 ) = E(mu2) + b11 ( mu1 - E(mu1) ) + b12 ( sigma1 - E(sigma1) )
# E( sigma2 | mu1, sigma1 ) = E(sigma2) + b21 ( mu1 - E(mu1) ) + b22 ( sigma1 - E(sigma1) )
# E(sigma2) + b21 ( mu1 - E(mu1) ) + b22 ( sigma1 - E(sigma1) ) >= 0 a.s.
# Then beta(s,t) = b11 + b12 ( s - E(mu1) ) / E(sigma1) + b21 ( t - E(mu2) ) / E(sigma2) +
# b22 ( ( s - E(mu1) ) / E(sigma1) ) ( ( t - E(mu2) ) / E(sigma2) )
bMat <- matrix( c( 0.5, 0.5, 0.5, -0.5 ), ncol = 2, byrow = TRUE )
n <- 100
# mu1 ~ Beta(2,2)
mu1 <- rbeta( n, 2, 2 ); Emu1 <- 0.5
# sigma1 ~ Uniform(0.5,1.5)
sigma1 <- runif( n, 0.5, 1.5 ); Esigma1 <- 1
# mu2 = E(mu2) + b11 ( mu1 - E(mu1) ) + b12 ( sigma1 - E(sigma1) ) + err_{mu2}
Emu2 <- 2
err_mu2 <- rnorm( n, mean = 0, sd = 0.1 ) # unexplained stochastic part
mu2True <- Emu2 + bMat[1,1] * ( mu1 - Emu1 ) + bMat[1,2] * ( sigma1 - Esigma1 )
mu2 <- mu2True + err_mu2
# sigma2 = E(sigma2) + b21 ( mu1 - E(mu1) ) + b22 ( sigma1 - E(sigma1) ) + err_{sigma2}
Esigma2 <- 2
err_sigma2 <- ( rbeta( n, 2, 2 ) - 0.5 ) / 5 # unexplained stochastic part
sigma2True <- Esigma2 + bMat[2,1] * ( mu1 - Emu1 ) + bMat[2,2] * ( sigma1 - Esigma1 )
sigma2 <- sigma2True + err_sigma2
nqSup <- 1000
qSup <- seq( 0, 1, length.out = nqSup+1 )
qSup <- ( qSup[-1] + qSup[-(nqSup+1)] ) / 2
X <- list(
X1 = sapply( seq_len(n), function (i) {
qnorm( qSup, mean = mu1[i], sd = sigma1[i] )
})
)
QXmean <- list(
qnorm( qSup, mean = Emu1, sd = Esigma1 )
)
QYmean <- qnorm( qSup, mean = Emu2, sd = Esigma2 )
Y <- sapply( seq_len(n), function (i) {
qnorm( qSup, mean = mu2[i], sd = sigma2[i] )
})
res <- WR( X = X, Y = Y, qSup = qSup )
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.