nnreg {lazy.stat}R Documentation

Non-negative or Ordered Regression

Description

This function fits the regression model y = X %*% beta + eps with the constraints:
1) beta[j] > 0, j=omit+1, omit+2, ...., ncol(X)
or
2) beta[1] < beta[2] < ... beta[ncol(X)]

Usage

nnreg(
  y,
  X,
  beta = NULL,
  ms = 0,
  omit = 0,
  init = 1,
  maxiter = 50,
  maxiters = 10,
  eps = 1e-06,
  epsg = 1e-06,
  ymin = NA,
  ymax = NA,
  print = 1
)

Arguments

y

Vector of criterion variable

X

Matrix of regressor variables

beta

The initial value of beta

ms

= 1 to enforce the order constraints on beta
This should be used in conjunction with monotone spline.

omit

Constraints will not be enforced on beta[1:omit]

init

= 0 to use random initial when beta=NULL
otherwize, a rational initial will be used.

maxiter

# of iterations

maxiters

# of step size halving for GN

eps

Criterion of convergence for the relative improvement of rss

epsg

Criterion for the maximum absolute value of the gradient

ymin

Not yet available

ymax

Not yet available

print

= 1 to print the result

Details

Non-negative beta constraints 1:
beta[(omit+1):nq] > 0
can be enfoeced by reparametrizing
beta[(omit+1):nq] = exp(c)
where c is not restricted.

Increasing beta constraints 2:
beta[j] <= beta[j+1]
can be enfoeced as follows:
Let
beta = G %*% b
where G is the lower triangular design matrix consisting of ones
and
b[2:nq] > 0
That is,
beta = G %*% b = G %*% c(b1,exp(c))
or
y = X %*% G %*% b + error, with b[2:nq] > 0
The problem is now translated to the non-negative constraint.

Value

A list of:
beta Regression coefficient vector satisfying the constraint.
g Final gradient value.
rss Residual Sum of Squares minimized.
maxag Maximum of the absolute values of gradient.
bc vector of c( beta[1:omit], c[(omit+1):length(beta)]
omit conv = 1 to indicate convergence.
rssimpr Relative improvement of rss.
iter # of iterations required for convergence.

Note that, when ms=1, beta can be calculated as
b[1] <- bc[1]; b[2:nq] <- exp(bc[2:nq]); beta <- G %*% b
where G is the lower-half triangular matrix consisting of 1s.

Examples

set.seed(1701)
n=50; nq=9
X=cbind(1,matrix(rnorm(n*(nq-1)),n))
beta=(1:nq-1.8); beta=beta/max(beta)
y=X%*%beta + 0.7*rnorm(n)
# Simple non-negative regression
res=nnreg( y, X, print=1 )
# Enforce order restrictions on beta coef.
res=nnreg( y, X, ms=1, print=1 )



[Package lazy.stat version 0.1.4 Index]