Hi,
I am not sure how to create a rolling standard deviation using
, I read several posts but I did not find a response to why I have to few missing values.
I have a dataset with daily series (see below), skipping weekends
I need to create a monthly (24 obs) and a yearly (250 obs) rolling standard deviation
When i use
I thought that the first 23 rows would be empty, however only the first 1 is. How is this possible? And how can I correct it?
I tried
, but this does not work as it counts the weekends as missing value.
Is there a way to calculate the window from today-1 month ago?
I am not sure how to create a rolling standard deviation using
Code:
tsegen
I have a dataset with daily series (see below), skipping weekends
I need to create a monthly (24 obs) and a yearly (250 obs) rolling standard deviation
When i use
Code:
tsegen rolling_30d_sd = rowsd(L(0/).all_share_index)
I tried
Code:
tsegen rolling_30d_sd = rowsd(L(0/).all_share_index, 24)
Is there a way to calculate the window from today-1 month ago?
Code:
* Example generated by -dataex-. To install: ssc install dataex clear input int date byte encoded double all_share_index str41 country 17167 1 376.69 "CYPRUS" 17168 1 381.44 "CYPRUS" 17169 1 385.21 "CYPRUS" 17170 1 383.43 "CYPRUS" 17171 1 395.64 "CYPRUS" 17174 1 406.45 "CYPRUS" 17175 1 413.5 "CYPRUS" 17176 1 410.89 "CYPRUS" 17177 1 425.99 "CYPRUS" 17178 1 428.67 "CYPRUS" 17181 1 423.41 "CYPRUS" 17182 1 406.93 "CYPRUS" 17183 1 407.93 "CYPRUS" 17184 1 418.21 "CYPRUS" 17185 1 427.89 "CYPRUS" 17188 1 432.01 "CYPRUS" 17189 1 422.86 "CYPRUS" 17190 1 415.44 "CYPRUS" 17191 1 415.76 "CYPRUS" 17192 1 410.42 "CYPRUS" 17195 1 401.93 "CYPRUS" 17196 1 395.61 "CYPRUS" 17197 1 406.35 "CYPRUS" 17198 1 414.38 "CYPRUS" 17199 1 416.35 "CYPRUS" 17202 1 415.95 "CYPRUS" 17203 1 413.66 "CYPRUS" 17204 1 416.82 "CYPRUS" 17205 1 418.19 "CYPRUS" 17206 1 410.49 "CYPRUS" 17209 1 402.48 "CYPRUS" 17210 1 403.88 "CYPRUS" 17211 1 410 "CYPRUS" 17212 1 410.63 "CYPRUS" 17213 1 411.51 "CYPRUS" 17216 1 411.51 "CYPRUS" 17217 1 410.54 "CYPRUS" 17218 1 412.95 "CYPRUS" 17219 1 412.05 "CYPRUS" 17220 1 413.71 "CYPRUS" 17223 1 417.87 "CYPRUS" 17224 1 411.43 "CYPRUS" 17225 1 403.57 "CYPRUS" 17226 1 401.19 "CYPRUS" 17227 1 395.24 "CYPRUS" 17230 1 383.29 "CYPRUS" 17231 1 397.09 "CYPRUS" 17232 1 406.85 "CYPRUS" 17233 1 403.2 "CYPRUS" 17234 1 400.62 "CYPRUS" 17237 1 401.14 "CYPRUS" 17238 1 395.36 "CYPRUS" 17239 1 385.51 "CYPRUS" 17240 1 392.8 "CYPRUS" 17241 1 386.38 "CYPRUS" 17244 1 393.09 "CYPRUS" 17245 1 394.95 "CYPRUS" 17246 1 395.19 "CYPRUS" 17247 1 400.85 "CYPRUS" 17248 1 401.2 "CYPRUS" 17251 1 402.99 "CYPRUS" 17252 1 403.91 "CYPRUS" 17253 1 404.06 "CYPRUS" 17254 1 403.79 "CYPRUS" 17255 1 404.85 "CYPRUS" 17258 1 407.52 "CYPRUS" 17259 1 411.52 "CYPRUS" 17260 1 411.49 "CYPRUS" 17261 1 413.92 "CYPRUS" 17262 1 413.92 "CYPRUS" 17265 1 413.92 "CYPRUS" 17266 1 413.92 "CYPRUS" 17267 1 415.34 "CYPRUS" 17268 1 413.97 "CYPRUS" 17269 1 414.53 "CYPRUS" 17272 1 422.63 "CYPRUS" 17273 1 433.1 "CYPRUS" 17274 1 432.19 "CYPRUS" 17275 1 428.64 "CYPRUS" 17276 1 434.93 "CYPRUS" 17279 1 434.68 "CYPRUS" 17280 1 429.31 "CYPRUS" 17281 1 429.39 "CYPRUS" 17282 1 431.72 "CYPRUS" 17283 1 428.65 "CYPRUS" 17286 1 427.76 "CYPRUS" 17287 1 427.76 "CYPRUS" 17288 1 426.38 "CYPRUS" 17289 1 425.14 "CYPRUS" 17290 1 429.37 "CYPRUS" 17293 1 433.12 "CYPRUS" 17294 1 431.09 "CYPRUS" 17295 1 430.47 "CYPRUS" 17296 1 431.78 "CYPRUS" 17297 1 430.84 "CYPRUS" 17300 1 436.25 "CYPRUS" 17301 1 440.37 "CYPRUS" 17302 1 450.19 "CYPRUS" 17303 1 459.83 "CYPRUS" 17304 1 462.02 "CYPRUS" end format %tdnn/dd/CCYY date label values encoded encoded
Comment