I have written a rolling z-score function myself. Is my implementation of rolling z-score function correct?

#x is an xts object and y duration eg rollz(x,25)
  avg=rollapply(x, y, mean)
  std=rollapply(x, y, sd)


Here is the description of z-score. A rolling (moving) z-score calculates z-score at a particular width like how we calculate simple moving averages.

  • \$\begingroup\$ Welcome to Code Review. You may want to add a link to inform reviews of what a "rolling z-score" is, seems like a pretty specialized term. \$\endgroup\$ – Phrancis Jul 15 '16 at 5:04
  • \$\begingroup\$ I have edited the question and added more information \$\endgroup\$ – Eka Jul 15 '16 at 5:12
  • 1
    \$\begingroup\$ Excellent. Hope you get some good answers! \$\endgroup\$ – Phrancis Jul 15 '16 at 5:13
  • \$\begingroup\$ What's an xts object ? \$\endgroup\$ – Siobhan Jul 20 '16 at 23:20
  • \$\begingroup\$ its a time series object. I am passing data with time series as the index \$\endgroup\$ – Eka Jul 21 '16 at 1:43

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.