BoxCox_Periodicity_Standardization: Box cox transformation and standardization of the within day...

Description Usage Arguments Details Value Examples

View source: R/BoxCox_Periodicity_Standardization.R

Description

A function that standardize the intra day periodicity on the scale of boxcox transformation.

Usage

1
2
BoxCox_Periodicity_Standardization(ts_vec, M, t, sec, N = 1,
  quantity_label, sample_label, saving_directory, lambda_length = 100)

Arguments

ts_vec

a vector for the time series waiting to standardize the within day periodicity.

M

an integer indicating the within day sampling frequency.

t

the total number of days in the sample.

sec

the intra sampling times in seconds.

N

the number of the consecutive days the periodicity is defined on, default = 1.

quantity_label

the name of the ts quantity, for the axis labe of the visualization.

sample_label

the name of the sample, for the subtitle of the visualization.

saving_directory

the name of the directory to be saved, control the file names.

lambda_length

the search length of the boxcox exponent parameter over the range [0,1], default = 500.

Details

This function will together generate a set of motivation / diagnosis plots for the standardization. Also, it will conduct long memory test on the TS before and after standardization.

Value

a matrix of 2 collumns, one for the not standardized daily sum quantity, one for the standardized daily sum quantity.

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
## Not run: 

return_SPY <- readstata13::read.dta13("SPY 30 Sec Summary Return Data.dta")
t = length(unique(return_SPY$date))
M = table(return_SPY$date)[1]
volume_vec = return_SPY$volume
rm(return_SPY)

#Intra day standardization
SherryChapter1::BoxCox_Periodicity_Standardization(ts_vec = volume_vec,
                                                  M = M,
                                                  t = t,
                                                  sec = 30,
                                                  N = 1,
                                                  quantity_label = "Volume",
                                                  sample_label = "SPY 30 sec",
                                                  saving_directory = "volume_standardized_day")

#Intra week standardization
SherryChapter1::BoxCox_Periodicity_Standardization(ts_vec = volume_vec,
                                                  M = M,
                                                  t = t,
                                                  sec = 30,
                                                  N = 5,
                                                  quantity_label = "Volume",
                                                  sample_label = "SPY 30 sec",
                                                  saving_directory = "volume_standardized_week")


## End(Not run)

ZhenWei10/Sherry-Chapter1 documentation built on Oct. 31, 2019, 1:48 a.m.