increase/decrease volatility (std deviation) of dataset by certain percentage

조회 수: 2 (최근 30일)
Jon Jae
Jon Jae 2020년 4월 2일
편집: Jon Jae 2020년 4월 4일
Hey everbody,
I am aiming to increase/decrease the volatility / std deviation of historic price data (N = 7600) by a certain percentage. Best would be if I could set the percentage variation (e.g., 10%) by which the std() is increased after manipulation.
Is there a specific function or a genaral accepted approach to this? Couldn't find anything in the literature.
My current approach (code below): (1) calculate mean, (2) values above/below mean are increased/decreased by a certain factor. The increase/decrease is currently somewhat random, e.g., in the example below the increase is 85%.
A = [32050,31860,31780,31510,31990,33020,34990,37930,40240,40080,39540,37930,34940,34800,34420,34940,35630,43150,49050,39390,35810,34920,33570,32960,34670,33970,33970,33610,33620,33860,34590,35490,36900,40660,44600,42400,40640,38010,35970,35870]
% manipulation setting
percVariation = 0.1
increase = 1 + variation
decrease = 1 - variation
%increasing/decreasing values
for ii = 1:numel(A)
if A(ii) >= mean(A) %no particular reason 'greater equals', negelectable in larger data set
B(ii) = A(ii) * increase;
else A(ii) < mean(A)
B(ii) = A(ii) * decrease;
end
end
% calculating increase/decrease
change = ((std(B) - std(A)) / std(A))
plot(A)
hold on
plot(B)
legend('A', 'manipulated')
Background: This is to be part of a senstivity analysis. It will be used to investigate the performance of an scheduling algorihtm of an hydropower faccility. Prices in DK and Germany are more volatile due to more green energy.

답변 (0개)

카테고리

Help CenterFile Exchange에서 Multidimensional Arrays에 대해 자세히 알아보기

제품


릴리스

R2019b

Community Treasure Hunt

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

Start Hunting!

Translated by