Skip to content
This repository was archived by the owner on Nov 22, 2017. It is now read-only.
This repository was archived by the owner on Nov 22, 2017. It is now read-only.

.movingstd() does not seem to display correct values #177

Description

@Michael-EV

Hello!

After noticing that .movingstd() does not have a 'position' option like .movingaverage(), I decided to look at the source code to see what the default position is for .movingstd(). Ater determining that it is 'left' I decided to compare the values it spits out to the actual moving standard deviation (which I computed in R -- code is at the bottom -- it is worth nothing that my values for moving average were the same as Timelion's .movingaverage()). I noticed that my sd values were not the same as Timelion's whether I used a population or sample standard deviation. However, the graph for my moving standard deviation and Timelion's .movingstd() were roughly the same shape.

Thanks.


My Timelion query: ".quandl(WIKI/FB), .quandl(WIKI/FB).movingstd(5), .quandl(WIKI/FB).movingaverage(5)", with time interval set to '1w' and time frame set to '6 months'


Here is my code for moving standard deviation in R:

`FB_data <- c(110.05, 108.48, 111.56, 112.13, 113.75, 114.25, 110.79, 111.21, 116.82, 117.16, 120.38, 116.96, 119.56, 118.97, 117.54, 114.42, 111.01, 114.20, 116.43, 117.74, 119.90, 124.65, 124.98, 124.70, 123.60, 124.05) ## this was taken from Timelion

mov_sd <- c()
for(i in 1:(length(FB_data) - 5))
{
mov_sd <- c(mov_sd, sd(FB_data[i:(i+4)])); ## take sd of FB_data[1:5], then FB_data[2:6], etc...
}

mov_sd <- round(mov_sd, digits=2)
plot(mov_sd, type = 'l') ## graph to compare to Timelion .movingstd() -- very similar shape
`

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions