Generic function for coercing to "variance"
. There is a default
method and a method for "volatility"
.
Usage
as.variance(x, ...)
# S3 method for default
as.variance(x, annualized = FALSE, dib = NULL, ...)
# S3 method for volatility
as.variance(x, ...)
Arguments
- x
an object whose class will determine the method to be dispatched. Value is the volatility or variance.
- ...
further arguments to be passed to the next method, such as:
- annualized
for default method, TRUE if variance value in x is annualized, FALSE if variance is daily.
- dib
days in one year, day count convention.
Examples
as.variance(1)
#> Daily Variance
#> [1] 1
as.variance(as.volatility(.5))
#> Daily Variance
#> [1] 0.25
as.variance(0.2, TRUE, 252)
#> Annual Variance 252 days
#> [1] 0.2
as.variance(as.volatility(100:300 / 100, TRUE))
#> Annual Variance days
#> [1] 0.00010000 0.00010201 0.00010404 0.00010609 0.00010816 0.00011025
#> [7] 0.00011236 0.00011449 0.00011664 0.00011881 0.00012100 0.00012321
#> [13] 0.00012544 0.00012769 0.00012996 0.00013225 0.00013456 0.00013689
#> [19] 0.00013924 0.00014161 0.00014400 0.00014641 0.00014884 0.00015129
#> [25] 0.00015376 0.00015625 0.00015876 0.00016129 0.00016384 0.00016641
#> [31] 0.00016900 0.00017161 0.00017424 0.00017689 0.00017956 0.00018225
#> [37] 0.00018496 0.00018769 0.00019044 0.00019321 0.00019600 0.00019881
#> [43] 0.00020164 0.00020449 0.00020736 0.00021025 0.00021316 0.00021609
#> [49] 0.00021904 0.00022201 0.00022500 0.00022801 0.00023104 0.00023409
#> [55] 0.00023716 0.00024025 0.00024336 0.00024649 0.00024964 0.00025281
#> [61] 0.00025600 0.00025921 0.00026244 0.00026569 0.00026896 0.00027225
#> [67] 0.00027556 0.00027889 0.00028224 0.00028561 0.00028900 0.00029241
#> [73] 0.00029584 0.00029929 0.00030276 0.00030625 0.00030976 0.00031329
#> [79] 0.00031684 0.00032041 0.00032400 0.00032761 0.00033124 0.00033489
#> [85] 0.00033856 0.00034225 0.00034596 0.00034969 0.00035344 0.00035721
#> [91] 0.00036100 0.00036481 0.00036864 0.00037249 0.00037636 0.00038025
#> [97] 0.00038416 0.00038809 0.00039204 0.00039601 0.00040000 0.00040401
#> [103] 0.00040804 0.00041209 0.00041616 0.00042025 0.00042436 0.00042849
#> [109] 0.00043264 0.00043681 0.00044100 0.00044521 0.00044944 0.00045369
#> [115] 0.00045796 0.00046225 0.00046656 0.00047089 0.00047524 0.00047961
#> [121] 0.00048400 0.00048841 0.00049284 0.00049729 0.00050176 0.00050625
#> [127] 0.00051076 0.00051529 0.00051984 0.00052441 0.00052900 0.00053361
#> [133] 0.00053824 0.00054289 0.00054756 0.00055225 0.00055696 0.00056169
#> [139] 0.00056644 0.00057121 0.00057600 0.00058081 0.00058564 0.00059049
#> [145] 0.00059536 0.00060025 0.00060516 0.00061009 0.00061504 0.00062001
#> [151] 0.00062500 0.00063001 0.00063504 0.00064009 0.00064516 0.00065025
#> [157] 0.00065536 0.00066049 0.00066564 0.00067081 0.00067600 0.00068121
#> [163] 0.00068644 0.00069169 0.00069696 0.00070225 0.00070756 0.00071289
#> [169] 0.00071824 0.00072361 0.00072900 0.00073441 0.00073984 0.00074529
#> [175] 0.00075076 0.00075625 0.00076176 0.00076729 0.00077284 0.00077841
#> [181] 0.00078400 0.00078961 0.00079524 0.00080089 0.00080656 0.00081225
#> [187] 0.00081796 0.00082369 0.00082944 0.00083521 0.00084100 0.00084681
#> [193] 0.00085264 0.00085849 0.00086436 0.00087025 0.00087616 0.00088209
#> [199] 0.00088804 0.00089401 0.00090000