Title: | A Companion Package to the Book "U-Statistics, M-Estimation and Resampling" |
Version: | 1.0.0 |
Author: | Snigdhansu Chatterjee <chatt019@umn.edu> |
Maintainer: | Snigdhansu Chatterjee <chatt019@umn.edu> |
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. |
Depends: | R (≥ 3.2.3) |
Suggests: | MASS |
License: | GPL-3 |
Encoding: | UTF-8 |
LazyData: | true |
RoxygenNote: | 5.0.1.9000 |
NeedsCompilation: | no |
Packaged: | 2016-12-27 15:53:42 UTC; Anshu_Regular |
Repository: | CRAN |
Date/Publication: | 2016-12-27 17:50:42 |
Precipitation for June-September 2012 recorded in Kolkata
Description
Precipitation for June-September 2012 recorded in Kolkata
Usage
data(CCU12_Precip)
Format
A data frame with columns
- Date
The data in Year-Month-Day format
- Precip
Precipitation in millimeters
- TMax
Maximum temperature, in Celcius
- TMin
Minimum temperature, in Celcius
Examples
Precip <-CCU12_Precip$Precip
TMax <-CCU12_Precip$TMax
plot(TMax, Precip)
Computes a linear regression fit and residuals on possibly multivariate responses
Description
Computes a linear regression fit and residuals on possibly multivariate responses
Usage
FitAndResiduals(Y, X, BetaHat)
Arguments
Y |
a numeric matrix, to act as response |
X |
a numeric matrix, to act as covariates |
BetaHat |
a numeric matrix, to act as slope |
Value
a list consisting of two vectors, the fitted values and residuals
Examples
## 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
Description
Obtains the identity matrix of dimension n
Usage
IdentityMatrix(n)
Arguments
n |
an integer |
Value
an identity matrix
Examples
I.3 = IdentityMatrix(3)
print(I.3)
Computes the Euclidean inner product
Description
Computes the Euclidean inner product
Usage
InnerProduct(a, b, na.rm)
Arguments
a |
a numeric vector |
b |
another numeric vector |
na.rm |
logical |
Value
a real number
Examples
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
Description
Computes a L1 multivariate regression This is the equivalent of median regression when the response is possibly multivariate
Usage
L1Regression(Data.Y, Data.X, Weights,
InitialValue = "WLS", MaxIteration, epsilon, lambda)
Arguments
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 |
Value
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
Examples
## 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
Description
Computes the Euclidean norm
Usage
Norm(a, na.rm)
Arguments
a |
a numeric vector |
na.rm |
logical |
Value
a real number
Examples
x <- c(1, 2)
Norm(x)
Computes a weighted least squares linear regression on possibly multivariate responses
Description
Computes a weighted least squares linear regression on possibly multivariate responses
Usage
WLS(Y, X, W)
Arguments
Y |
a numeric matrix, to act as response |
X |
a numeric matrix, to act as covariates |
W |
a numeric matrix, to act as weights |
Value
a vector of regression coefficients
Examples
## 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)