What function to use to calculate a vector of variance ratios

5 visualizaciones (últimos 30 días)
Jack Bratton
Jack Bratton el 22 de Abr. de 2018
Respondida: Divyajyoti Nayak el 26 de Feb. de 2025
I have a vector of stock returns (or prices, whichever is needed), and need to calculate the variance ratio over time. Each of the variance ratio functions that I found only returned one number, the variance ratio test number. I need a vector of variance ratios for the entire time period. Is there a function that would allow me to do this?

Respuestas (1)

Divyajyoti Nayak
Divyajyoti Nayak el 26 de Feb. de 2025
You can use the 'vratiotest' function that you've mentioned to get the variance ratios across a vector. Normally the 'vratiotest' returns only the variance test rejection decision, but it has multiple arguments including a vector of variance ratios. Here's the documentation for it and some sample code:
load Data_GlobalIdx1
dates = datetime(dates,ConvertFrom="datenum");
TT = table2timetable(DataTable,RowTimes=dates);
LTT = varfun(@log,TT(:,2:end));
q = [2 4 8 2 4 8];
iid = logical([1 1 1 0 0 0]);
[StatTbl,ratio] = vratiotest(LTT,Period=q,IID=iid,DataVariable="log_SP")
StatTbl = 6x7 table
h pValue stat cValue Alpha Period IID _____ ________ ________ ______ _____ ______ _____ Test 1 false 0.56704 0.57242 1.96 0.05 2 true Test 2 false 0.33073 -0.97265 1.96 0.05 4 true Test 3 true 0.030933 -2.1579 1.96 0.05 8 true Test 4 false 0.70045 0.38471 1.96 0.05 2 false Test 5 false 0.50788 -0.66214 1.96 0.05 4 false Test 6 false 0.13034 -1.5128 1.96 0.05 8 false
ratio = 6×1
1.0111 0.9647 0.8763 1.0111 0.9647 0.8763
<mw-icon class=""></mw-icon>
<mw-icon class=""></mw-icon>

Categorías

Más información sobre Symbolic Math Toolbox en Help Center y File Exchange.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by