Learn R Programming

cpcens (version 0.1.0)

AR1.data: Most recent changepoints

Description

Detecting most recent changepoints using censored data generated from AR model.

Usage

AR1.data(n = 500, N = 100, K = 5, eps = 1, rho = 0.6, mu = 0,
  siga = 1, rates = c(NA, 0.2), Mrate = 0)

Arguments

n

length of series, default 500.The size of series (n) should be greater than 200.

N

number of series, default 100.

K

number of most recent changepoints, default 5.

eps

size of the mean change at the most recent changepoint.

rho

ar coefficients

mu

mean

siga

standard deviation of innovations

rates

either a vector of length 2 or a matrix with n rows and 2 columns. In the vector case, the first element indicates the left-censor rate and the second element indicates the right-censor rate. Set to NA if there is no censoring. Interval censored data corresponds to setting both a left-censor rate and right-censor rate. The default setting indicates a right-censor rate 0.2 with no left censoring. The vector case handles single censoring and the matrix case is for multiple censor points. In this case each column indicates the corresponding censoring for each observation.

Mrate

fraction of missing values. Default is 0

Value

an object of class 'censored' which is a list with four elements. First element, 'data', is the censored time series. Second element, 'mrc',indicates most recent changepoints. Third element, 'series.mrc', indicates which series is affecting from which most recent changepoint . Fourth element, 'series.chpts' indicates the changepoints in each series.

Examples

Run this code
# NOT RUN {
#Default example
library(cpcens)
ans<-AR1.data()
#example (right censoring)
out = AR1.data ( n=500 , N = 100 , K = 5 , eps = 1 , rho=0.2,
mu = 0,  siga = 1, rates = c(NA,0.4), Mrate=0 )
#example (left censoring)
out = AR1.data( n=500 , N = 100 , K = 5 , eps = 1 , rho=0.4,
mu = 0,  siga = 1, rates = c(0.3,NA), Mrate=0 )
#example (interval censoring)
out = AR1.data ( n=500 , N = 100 , K = 5 , eps = 1 , rho=0.4,
mu = 0,  siga = 1, rates = c(0.4,0.5), Mrate=0 )
# }

Run the code above in your browser using DataLab