# stick.ar.0: Broken-Stick Regression for Independent Data In bentcableAR: Bent-Cable Regression for Independent Data or Autoregressive Time Series

## Description

This function is the main engine for `bentcable.ar` when a broken stick (i.e. γ=0 for bent cable) model is assumed for independent data. For AR(p) time-series data, this function is intended for determining an appropriate p and initial values for the stick parameters.

## Usage

 `1` ```stick.ar.0(init.vect, y.vect, t.vect = NULL, n = NA) ```

## Arguments

 `init.vect` A numeric vector of initial values, in the form of `c(b0,b1,b2,tau)`. `y.vect` A numeric vector of response data. `t.vect` A numeric vector of design points, which need not be equidistant. Specifying `t.vect=NULL` is equivalent to specifying the default time points `c(0,1,2,...)`. `n` Length of response vector (optional).

## Details

The returned object is compatible with a `cable.ar.p.iter` object for independent data.

The broken stick as a special case of the bent cable has form f(t) = b_0 + b_1 t + b_2 (t-τ) I\{t>τ\} .

Broken-stick regression by maximum likelihood for independent data is performed via nonlinear least-squares estimation of θ=(b_0,b_1,b_2,τ) through the built-in R function `nls`. The estimation relies on the user-supplied initial values in `init`.

## Value

 `fit` An `nls` object that is the maximum likelihood fit. `y, t, n` As supplied by the user. `p, stick` The values `0` and `TRUE`, respectively; used internally by `bentcable.ar` and `cable.ar.0.fit`.

## Note

This function is intended for internal use by `bentcable.ar`.

Grace Chiu

## References

See the `bentcableAR` package references.

`cable.ar.p.iter`, `fullcable.t`, `cable.fit.known.change`.

## Examples

 ```1 2 3``` ```data(sockeye) stick.ar.0( c(13,.1,-.7,12), sockeye\$logReturns ) ```

### Example output

```Trying 'nls()' Gauss-Newton algorithm...
12.1804 :  13.0  0.1 -0.7 12.0
8.916925 :  13.24087877  0.02560975 -0.50014863 11.57224783
8.854351 :  13.25855520  0.02078893 -0.52236006 11.80691892
8.854106 :  13.25855526  0.02078892 -0.52236005 11.79694061
Converged!
\$fit
Nonlinear regression model
model: y.vect ~ fullcable.t(t.vect, b0, b1, b2, tau, 0)
data: parent.frame()
b0       b1       b2      tau
13.25856  0.02079 -0.52236 11.79694
residual sum-of-squares: 8.854

Number of iterations to convergence: 3
Achieved convergence tolerance: 1.409e-07

\$y
 12.655625 13.655085 13.667217 13.417511 12.499414 13.437136 13.966513
 13.732741 13.682008 12.992086 13.618007 13.151390 13.654253 12.884477
 11.789193 11.671612 11.082143 12.528156 10.858999  8.188689  9.903488

\$t
  0  1  2  3  4  5  6  7  8  9 10 11 12 13 14 15 16 17 18 19 20

\$n
 21

\$p
 0

\$stick
 TRUE
```

bentcableAR documentation built on May 2, 2019, 11:01 a.m.