Description Usage Arguments Value Examples
Create a censored time series response object of cenTS
class. Default name of the response is "value",
with the vectors of lower/upper censoring limits denoted by lcl
and ucl
respectively.
The vector of censoring indicators, i.e., ci
, is part of the cenTS
object.
Additional related variables can be stored and provided in the construction function, whose names
are stored in xreg
. All variable values are assumed to be of the same length of and thus
aligned with the censored response time series. cenTS
inherits from xts::xts.
1 2 |
value |
the value vector. |
order.by |
the index vector, must be a vector of time/date. |
lcl |
the vector of lower censoring limits, or a single numeric representing the constant limit.
Default = |
ucl |
the vector of upper censoring limits, or a single numeric representing the constant limit.
Default = |
ci |
the vector of censoring indicators whose value is -1 (0, 1)
if the corresponding response is left censored (observed, right censored).
Default = |
value.name |
the name of the value, default = "value". |
... |
additional variables, must be able to be coerced to a |
a cenTS
object, any censored observation will be replaced by its corresponding censoring limit.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 | strDates <- c("2000-01-01", "2000-01-02", "2000-01-03", "2000-01-04", "2000-01-05")
ts <- cenTS(value=c(1,-2,1,NA,0),
order.by=as.Date(strDates,"%Y-%m-%d"),
lcl=c(-3,-2,-1,-1,0),
ucl=c(3,2,1,1,1),
x=c(1,1,1,1,1),
y=c(2,2,2,2,2))
print(ts)
print(xreg(ts))
plot(ts)
## Not run:
#wrong call, case 1
ts <- cenTS(value=c(1,-2,1,NA,0),
order.by=as.Date(strDates,"%Y-%m-%d"),
lcl=c(-3,-2,-1,-1,0),
ucl=c(3,2,1,1,1),
ci =c(-1,-1,1,NA,-1)
)
#wrong call, case 2
ts <- cenTS(value=c(1,-2,1,NA,0),
order.by=as.Date(strDates,"%Y-%m-%d"),
lcl=c(-3,-2,-1,-1,0),
ucl=c(3,2,1,1,1),
ci =c(1,-1,1,NA,-1)
)
#wrong call, case 3
ts <- cenTS(value=c(1,-2,1,NA,0),
order.by=as.Date(strDates,"%Y-%m-%d"),
lcl=c(-3,-2,-1,-1,0),
ucl=c(3,2,1,1,1),
ci =c(0,-1,0,NA,-1)
)
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.