Type: | Package |
Title: | Robust Bent Line Regression |
Version: | 0.1.0 |
Maintainer: | Feipeng Zhang <zhangfp108@gmail.com> |
Description: | An implementation of robust bent line regression. It can fit the bent line regression and test the existence of change point, for the paper, "Feipeng Zhang and Qunhua Li (2016). Robust bent line regression, submitted." |
License: | GPL-2 | GPL-3 [expanded from: GPL (≥ 2.0)] |
LazyData: | TRUE |
RoxygenNote: | 5.0.1 |
Depends: | R (≥ 3.1.0), Rfit |
URL: | http://arxiv.org/abs/1606.02234 |
NeedsCompilation: | no |
Packaged: | 2016-06-08 02:04:42 UTC; Frank2015 |
Author: | Feipeng Zhang [cre], Qunhua Li [aut] |
Repository: | CRAN |
Date/Publication: | 2016-06-08 05:46:58 |
MRS data
Description
A dataset containing the mass, speed and hopper indicator for land animals. The variables are as follows:
Usage
data(data_mrs)
Format
A data frame with 107 rows and 3 variables
- mass
the mass of animals
- speed
the speed of animals
- hopper
the indicator variabel of hoppers
Source
Garland, T.(1983).
References
Garland, T.(1983). The relation between maximal running speed and body mass in terrestrial mammals. Journal of Zoology 199, 157–170.
Examples
## Not run:
data(data_mrs)
summary(data_mrs)
## End(Not run)
bedload transport data
Description
A dataset containing the discharge, the bedload transport rate The variables are as follows:
Usage
data(data_transport)
Format
A data frame with 76 rows and 2 variables
- x
the discharge (cubic meters/second)
- y
the bedload transport rate (kilograms/second)
Source
Ryan, S., Porth, L., Troendle, C. (2002).
References
Ryan, S., Porth, L., Troendle, C. (2002). Defining phases of bedload transport using piecewise regression. Earth Surface Processes and Landforms 27, 971–990.
Ryan, S., Porth, L. (2007). A tutorial on the piecewise regression approach applied to bedload transport data. US Department of Agriculture, Forest Service, Rocky Mountain Research Station Fort Collins, CO, 1–41.
Examples
data(data_transport)
summary(data_transport)
rank estimation for bent line regression
Description
This function use Wilcoxon score functions for fitting the bent line regression model.
Usage
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
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)
test the existence of change point in the bent line regression
Description
This function use Wilcoxon score functions for calculating the test statistics and p-value by wild bootstrap.
Usage
rbenttest(y, z, x, NB = 1000, myseed = 1)
Arguments
y |
A vector of response |
z |
A vector of covariates |
x |
A numeric variable with change point |
NB |
resampling times |
myseed |
set seed |
Value
A list with the elements
Tn |
The statistic based on original data. |
Tn.NB |
The statistics by wild bootstrap. |
p.value |
The p-value by wild bootstrap. |
Author(s)
Feipeng Zhang
Examples
# for the example of MRS data
data(data_mrs)
x <- log(data_mrs$mass)
y <- log(data_mrs$speed)
z <- data_mrs$hopper
p.value <- rbenttest(y, cbind(1, z), x, NB = 50)$p.value
# for the example of bedload transport data
data(data_transport)
x <- data_transport$x
y <- data_transport$y
p.value <- rbenttest(y, 1, x, NB = 50)$p.value