Title: | A Companion Package to the Book "U-Statistics, M-Estimation and Resampling" |
---|---|
Description: | A set of functions leading to multivariate response L1 regression. This includes functions on computing Euclidean inner products and norms, weighted least squares estimates on multivariate responses, function to compute fitted values and residuals. This package is a companion to the book "U-Statistics, M-estimation and Resampling", by Arup Bose and Snigdhansu Chatterjee, to appear in 2017 as part of the "Texts and Readings in Mathematics" (TRIM) series of Hindustan Book Agency and Springer-Verlag. |
Authors: | Snigdhansu Chatterjee <[email protected]> |
Maintainer: | Snigdhansu Chatterjee <[email protected]> |
License: | GPL-3 |
Version: | 1.0.0 |
Built: | 2025-02-11 03:11:26 UTC |
Source: | https://github.com/cran/UStatBookABSC |
Precipitation for June-September 2012 recorded in Kolkata
data(CCU12_Precip)
data(CCU12_Precip)
A data frame with columns
The data in Year-Month-Day format
Precipitation in millimeters
Maximum temperature, in Celcius
Minimum temperature, in Celcius
Precip <-CCU12_Precip$Precip TMax <-CCU12_Precip$TMax plot(TMax, Precip)
Precip <-CCU12_Precip$Precip TMax <-CCU12_Precip$TMax plot(TMax, Precip)
Computes a linear regression fit and residuals on possibly multivariate responses
FitAndResiduals(Y, X, BetaHat)
FitAndResiduals(Y, X, BetaHat)
Y |
a numeric matrix, to act as response |
X |
a numeric matrix, to act as covariates |
BetaHat |
a numeric matrix, to act as slope |
a list consisting of two vectors, the fitted values and residuals
## Not run: DataY = cbind(CCU12_Precip$Precip, CCU12_Precip$TMax); DataX = cbind(rep(1, length(CCU12_Precip$Precip)), CCU12_Precip$TMin) BetaHat.New = WLS(DataY, DataX) Results.New = FitAndResiduals(DataY, DataX, BetaHat.New); ## End(Not run)
## Not run: DataY = cbind(CCU12_Precip$Precip, CCU12_Precip$TMax); DataX = cbind(rep(1, length(CCU12_Precip$Precip)), CCU12_Precip$TMin) BetaHat.New = WLS(DataY, DataX) Results.New = FitAndResiduals(DataY, DataX, BetaHat.New); ## End(Not run)
Obtains the identity matrix of dimension n
IdentityMatrix(n)
IdentityMatrix(n)
n |
an integer |
an identity matrix
I.3 = IdentityMatrix(3) print(I.3)
I.3 = IdentityMatrix(3) print(I.3)
Computes the Euclidean inner product
InnerProduct(a, b, na.rm)
InnerProduct(a, b, na.rm)
a |
a numeric vector |
b |
another numeric vector |
na.rm |
logical |
a real number
x <- c(1, 2, 3) y <- c(3, 0, 1) InnerProduct(x, y)
x <- c(1, 2, 3) y <- c(3, 0, 1) InnerProduct(x, y)
Computes a L1 multivariate regression This is the equivalent of median regression when the response is possibly multivariate
L1Regression(Data.Y, Data.X, Weights, InitialValue = "WLS", MaxIteration, epsilon, lambda)
L1Regression(Data.Y, Data.X, Weights, InitialValue = "WLS", MaxIteration, epsilon, lambda)
Data.Y |
a numeric matrix, to act as response |
Data.X |
a numeric matrix, to act as covariates |
Weights |
a numeric matrix, to act as weights |
InitialValue |
a character, to denote how the initial estimate will be computed currently the only available option is WLS |
MaxIteration |
an integer, for the maximum number of iterations allowed |
epsilon |
a positive real number, as tolerance value for convergence |
lambda |
a real number between 0 and 1, to control the amount of update allowed in each iteration |
a list consisting of the iteration value at the last step, the difference in norms between the last two iterations, and the estimate of slope
## Not run: DataY = cbind(CCU12_Precip$Precip, CCU12_Precip$TMax); DataX = cbind(rep(1, length(CCU12_Precip$Precip)), CCU12_Precip$TMin) A2 = L1Regression(DataY, DataX) ## End(Not run)
## Not run: DataY = cbind(CCU12_Precip$Precip, CCU12_Precip$TMax); DataX = cbind(rep(1, length(CCU12_Precip$Precip)), CCU12_Precip$TMin) A2 = L1Regression(DataY, DataX) ## End(Not run)
Computes the Euclidean norm
Norm(a, na.rm)
Norm(a, na.rm)
a |
a numeric vector |
na.rm |
logical |
a real number
x <- c(1, 2) Norm(x)
x <- c(1, 2) Norm(x)
Computes a weighted least squares linear regression on possibly multivariate responses
WLS(Y, X, W)
WLS(Y, X, W)
Y |
a numeric matrix, to act as response |
X |
a numeric matrix, to act as covariates |
W |
a numeric matrix, to act as weights |
a vector of regression coefficients
## Not run: DataY = cbind(CCU12_Precip$Precip, CCU12_Precip$TMax); DataX = cbind(rep(1, length(CCU12_Precip$Precip)), CCU12_Precip$TMin) BetaHat.New = WLS(DataY, DataX) ## End(Not run)
## Not run: DataY = cbind(CCU12_Precip$Precip, CCU12_Precip$TMax); DataX = cbind(rep(1, length(CCU12_Precip$Precip)), CCU12_Precip$TMin) BetaHat.New = WLS(DataY, DataX) ## End(Not run)