predar.mse: Mean Squared Error using censored data generated from AR...

Description Usage Arguments Value See Also Examples

View source: R/pred(ar).R

Description

(Accuracy of prediction) One can find the mean squared error (MSE) to check how these different methods (ind, dcbs, mrc, agg, mv) perform if the objective is to make prediction.

Usage

1
predar.mse(chpts, data.train, data.test)

Arguments

chpts

changepoints that are obtained using the discussed method (ind, dcbs, mrc, agg, mv)

data.train

divide generated censored data from AR model into data.train and data.test. Here, we consider n=500 (size of each series) and N=100 (number of series) so we have a matrix of N*n. In data.train we leave out the five data points at the end of each series.

data.test

Remaining dataset (five time points at the end of each series) will be considered as data.test.

Value

return mean squared error (MSE)

See Also

AR1.data, indAR, Bin_segAR, PELT.MVar

Examples

 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
# example
#mean squared error to check the accuracy of ind method using
#censored data generated from AR model.
# data generated through AR model considering 60% censoring rate
#(Left censoring) and missing rate is equal to zero
library(cpcens)
sim = AR1.data ( n=500 , N = 100 , K = 5 , eps = 1 , rho=0.6,
mu = 0,  siga = 1, rates = c(0.6,NA), Mrate=0 )
data=sim$data
n=500
N=100
# training and test
data.train = sim$data[,1:(n-5)]
data.test = sim$data[,(n-4):n]
##If pen is equal to zero, penalty term will be equal to 2*log(n)
indar.chpts=indAR(data.train, pen=0)
indar.mse = predar.mse( indar.chpts , data.train , data.test )
indar.mse
#example
#mean squared error to check the accuracy of dcbs method using
#censored data generated from AR model.
library(cpcens)
# data generated through AR model considering 20% censoring rate
#(Right censoring) and missing rate is equal to zero
sim = AR1.data ( n=500 , N = 100 , K = 5 , eps = 1 , rho=0.4,
mu = 0,  siga = 1, rates = c(NA,0.2), Mrate=0 )
data=sim$data
n=500
N=100
# training and test
data.train = sim$data[,1:(n-5)]
data.test = sim$data[,(n-4):n]
dcbsar.chpts= Bin_segAR(data.train, 10)
dcbsar.mse = predar.mse( dcbsar.chpts , data.train , data.test )
dcbsar.mse

cpcens documentation built on Aug. 2, 2019, 5:05 p.m.

Related to predar.mse in cpcens...