rbentfit: rank estimation for bent line regression

Description Usage Arguments Value Author(s) Examples

View source: R/rbentfit.R

Description

This function use Wilcoxon score functions for fitting the bent line regression model.

Usage

1
rbentfit(y, z, x, bet.ini, tau.ini, tol = 1e-04, max.iter = 50)

Arguments

y

A vector of response

z

A vector of covariates

x

A numeric variable with change point

bet.ini

A initial vector of regression coefficients

tau.ini

A initial value of change point

tol

tolerance value, 1e-4 for default

max.iter

the maximum iteration steps

Value

A list with the elements

est

The estimated regression coefficients with intercept.

bp

The estimated change point.

est.se

The estimated standard error of the regression coefficients.

bp.est

The estimated standard error of the change point.

iter

The iteration steps.

Author(s)

Feipeng Zhang

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
n <- 150
x <- runif(n, 0, 4)
z <- rnorm(n, 1, 1)
y <- 1 + 0.5*z + 1.5*x  - 3 *pmax(x-2, 0)  + rt(n, 2)
rbentfit(y, cbind(1,z), x, bet.ini = c(0, 1, 1, -2), tau.ini = 1)

# for the example of  MRS data
data(data_mrs)
x <- log(data_mrs$mass)
y <- log(data_mrs$speed)
z <- data_mrs$hopper
tau.ini <- 3
dat.new <- data.frame(y=y, z1=z, z2 = x, z3=pmax(x-tau.ini,0))
library(Rfit)
fit.ini <- rfit(y~ z1 + z2 +z3, data= dat.new)   # with intercept
bet.ini <- fit.ini$coef
fit.rank <- rbentfit(y, cbind(1,z), x, bet.ini, tau.ini)

Rbent documentation built on May 2, 2019, 8:25 a.m.

Related to rbentfit in Rbent...