Title: | Robust Bent Line Regression |
---|---|
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." |
Authors: | Feipeng Zhang [cre], Qunhua Li [aut] |
Maintainer: | Feipeng Zhang <[email protected]> |
License: | GPL (>= 2.0) |
Version: | 0.1.0 |
Built: | 2024-11-21 05:35:30 UTC |
Source: | https://github.com/cran/Rbent |
A dataset containing the mass, speed and hopper indicator for land animals. The variables are as follows:
data(data_mrs)
data(data_mrs)
A data frame with 107 rows and 3 variables
the mass of animals
the speed of animals
the indicator variabel of hoppers
Garland, T.(1983).
Garland, T.(1983). The relation between maximal running speed and body mass in terrestrial mammals. Journal of Zoology 199, 157–170.
## Not run: data(data_mrs) summary(data_mrs) ## End(Not run)
## Not run: data(data_mrs) summary(data_mrs) ## End(Not run)
A dataset containing the discharge, the bedload transport rate The variables are as follows:
data(data_transport)
data(data_transport)
A data frame with 76 rows and 2 variables
the discharge (cubic meters/second)
the bedload transport rate (kilograms/second)
Ryan, S., Porth, L., Troendle, C. (2002).
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.
data(data_transport) summary(data_transport)
data(data_transport) summary(data_transport)
This function use Wilcoxon score functions for fitting the bent line regression model.
rbentfit(y, z, x, bet.ini, tau.ini, tol = 1e-04, max.iter = 50)
rbentfit(y, z, x, bet.ini, tau.ini, tol = 1e-04, max.iter = 50)
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 |
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. |
Feipeng Zhang
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)
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)
This function use Wilcoxon score functions for calculating the test statistics and p-value by wild bootstrap.
rbenttest(y, z, x, NB = 1000, myseed = 1)
rbenttest(y, z, x, NB = 1000, myseed = 1)
y |
A vector of response |
z |
A vector of covariates |
x |
A numeric variable with change point |
NB |
resampling times |
myseed |
set seed |
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. |
Feipeng Zhang
# 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
# 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