In [1]:
using TimeSeries
using Quandl

data = quandl("YAHOO/AAPL")["Adjusted Close"]


Out[1]:
100x1 TimeSeries.TimeArray{Float64,1,Date,Array{Float64,1}} 2016-01-06 to 2016-05-27

             Adjusted Close  
2016-01-06 | 99.5504         
2016-01-07 | 95.3489         
2016-01-08 | 95.8531         
2016-01-11 | 97.4052         
⋮
2016-05-24 | 97.9            
2016-05-25 | 99.62           
2016-05-26 | 100.41          
2016-05-27 | 100.35          

In [2]:
using Gadfly

In [3]:
p = plot(x = randn(3000), Geom.histogram(bincount = 100))


Out[3]:
x -14 -12 -10 -8 -6 -4 -2 0 2 4 6 8 10 12 14 -12.0 -11.5 -11.0 -10.5 -10.0 -9.5 -9.0 -8.5 -8.0 -7.5 -7.0 -6.5 -6.0 -5.5 -5.0 -4.5 -4.0 -3.5 -3.0 -2.5 -2.0 -1.5 -1.0 -0.5 0.0 0.5 1.0 1.5 2.0 2.5 3.0 3.5 4.0 4.5 5.0 5.5 6.0 6.5 7.0 7.5 8.0 8.5 9.0 9.5 10.0 10.5 11.0 11.5 12.0 -20 -10 0 10 20 -12.0 -11.5 -11.0 -10.5 -10.0 -9.5 -9.0 -8.5 -8.0 -7.5 -7.0 -6.5 -6.0 -5.5 -5.0 -4.5 -4.0 -3.5 -3.0 -2.5 -2.0 -1.5 -1.0 -0.5 0.0 0.5 1.0 1.5 2.0 2.5 3.0 3.5 4.0 4.5 5.0 5.5 6.0 6.5 7.0 7.5 8.0 8.5 9.0 9.5 10.0 10.5 11.0 11.5 12.0 -200 -150 -100 -50 0 50 100 150 200 250 300 350 -150 -145 -140 -135 -130 -125 -120 -115 -110 -105 -100 -95 -90 -85 -80 -75 -70 -65 -60 -55 -50 -45 -40 -35 -30 -25 -20 -15 -10 -5 0 5 10 15 20 25 30 35 40 45 50 55 60 65 70 75 80 85 90 95 100 105 110 115 120 125 130 135 140 145 150 155 160 165 170 175 180 185 190 195 200 205 210 215 220 225 230 235 240 245 250 255 260 265 270 275 280 285 290 295 300 -200 0 200 400 -150 -140 -130 -120 -110 -100 -90 -80 -70 -60 -50 -40 -30 -20 -10 0 10 20 30 40 50 60 70 80 90 100 110 120 130 140 150 160 170 180 190 200 210 220 230 240 250 260 270 280 290 300

In [4]:
data


Out[4]:
100x1 TimeSeries.TimeArray{Float64,1,Date,Array{Float64,1}} 2016-01-06 to 2016-05-27

             Adjusted Close  
2016-01-06 | 99.5504         
2016-01-07 | 95.3489         
2016-01-08 | 95.8531         
2016-01-11 | 97.4052         
⋮
2016-05-24 | 97.9            
2016-05-25 | 99.62           
2016-05-26 | 100.41          
2016-05-27 | 100.35          

In [5]:
using PyPlot


INFO: Recompiling stale cache file /Users/davekensinger/.julia/lib/v0.4/PyPlot.ji for module PyPlot.
INFO: Recompiling stale cache file /Users/davekensinger/.julia/lib/v0.4/PyCall.ji for module PyCall.
INFO: Recompiling stale cache file /Users/davekensinger/.julia/lib/v0.4/LaTeXStrings.ji for module LaTeXStrings.
WARNING: using PyPlot.plot in module Main conflicts with an existing identifier.

In [10]:
ts_length = 100
epsilon_values = randn(ts_length)
# print(epsilon_values)
# plot(epsilon_values, "b-")
plot(x=collect(1:100), y=epsilon_values, Geom.line)


Out[10]:
x -150 -100 -50 0 50 100 150 200 250 -100 -95 -90 -85 -80 -75 -70 -65 -60 -55 -50 -45 -40 -35 -30 -25 -20 -15 -10 -5 0 5 10 15 20 25 30 35 40 45 50 55 60 65 70 75 80 85 90 95 100 105 110 115 120 125 130 135 140 145 150 155 160 165 170 175 180 185 190 195 200 -100 0 100 200 -100 -90 -80 -70 -60 -50 -40 -30 -20 -10 0 10 20 30 40 50 60 70 80 90 100 110 120 130 140 150 160 170 180 190 200 -10 -9 -8 -7 -6 -5 -4 -3 -2 -1 0 1 2 3 4 5 6 7 8 9 10 -9.0 -8.8 -8.6 -8.4 -8.2 -8.0 -7.8 -7.6 -7.4 -7.2 -7.0 -6.8 -6.6 -6.4 -6.2 -6.0 -5.8 -5.6 -5.4 -5.2 -5.0 -4.8 -4.6 -4.4 -4.2 -4.0 -3.8 -3.6 -3.4 -3.2 -3.0 -2.8 -2.6 -2.4 -2.2 -2.0 -1.8 -1.6 -1.4 -1.2 -1.0 -0.8 -0.6 -0.4 -0.2 0.0 0.2 0.4 0.6 0.8 1.0 1.2 1.4 1.6 1.8 2.0 2.2 2.4 2.6 2.8 3.0 3.2 3.4 3.6 3.8 4.0 4.2 4.4 4.6 4.8 5.0 5.2 5.4 5.6 5.8 6.0 6.2 6.4 6.6 6.8 7.0 7.2 7.4 7.6 7.8 8.0 8.2 8.4 8.6 8.8 9.0 -10 -5 0 5 10 -9.0 -8.5 -8.0 -7.5 -7.0 -6.5 -6.0 -5.5 -5.0 -4.5 -4.0 -3.5 -3.0 -2.5 -2.0 -1.5 -1.0 -0.5 0.0 0.5 1.0 1.5 2.0 2.5 3.0 3.5 4.0 4.5 5.0 5.5 6.0 6.5 7.0 7.5 8.0 8.5 9.0 y

In [11]:
using Distributions

In [19]:
epsilon_values = rand(Laplace(), 500)
epsilon_values


Out[19]:
500-element Array{Float64,1}:
  1.421     
 -0.181596  
 -3.23854   
  2.24198   
  1.20672   
 -0.863466  
 -1.31342   
  0.608764  
  0.791124  
 -2.51794   
  0.434766  
  1.5802    
  0.415043  
  ⋮         
  0.723574  
 -0.684548  
  0.285117  
  0.396163  
  0.793288  
 -1.74918   
  0.629827  
  0.0986058 
 -0.459962  
 -0.00368334
 -0.526847  
  0.016431  

In [21]:
plot(x=epsilon_values, Geom.histogram)


Out[21]:
x -20 -15 -10 -5 0 5 10 15 20 -15.0 -14.5 -14.0 -13.5 -13.0 -12.5 -12.0 -11.5 -11.0 -10.5 -10.0 -9.5 -9.0 -8.5 -8.0 -7.5 -7.0 -6.5 -6.0 -5.5 -5.0 -4.5 -4.0 -3.5 -3.0 -2.5 -2.0 -1.5 -1.0 -0.5 0.0 0.5 1.0 1.5 2.0 2.5 3.0 3.5 4.0 4.5 5.0 5.5 6.0 6.5 7.0 7.5 8.0 8.5 9.0 9.5 10.0 10.5 11.0 11.5 12.0 12.5 13.0 13.5 14.0 14.5 15.0 -20 -10 0 10 20 -15 -14 -13 -12 -11 -10 -9 -8 -7 -6 -5 -4 -3 -2 -1 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 -30 -25 -20 -15 -10 -5 0 5 10 15 20 25 30 35 40 45 50 55 -25 -24 -23 -22 -21 -20 -19 -18 -17 -16 -15 -14 -13 -12 -11 -10 -9 -8 -7 -6 -5 -4 -3 -2 -1 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 -25 0 25 50 -26 -24 -22 -20 -18 -16 -14 -12 -10 -8 -6 -4 -2 0 2 4 6 8 10 12 14 16 18 20 22 24 26 28 30 32 34 36 38 40 42 44 46 48 50

In [13]:
lp = Laplace()


Out[13]:
Distributions.Laplace(μ=0.0, θ=1.0)

In [16]:
plot_histogram(lp, 500)


LoadError: MethodError: `plot` has no method matching plot(::Array{Float64,1}, ::Function)
Closest candidates are:
  plot(!Matched::Union{Array{Gadfly.Layer,1},Union{DataType,Function,Gadfly.Element,Gadfly.Theme}}...)
  plot(!Matched::Union{AbstractArray{T,2},DataFrames.AbstractDataFrame}, ::Union{Array{Gadfly.Layer,1},Union{DataType,Function,Gadfly.Element,Gadfly.Theme}}...)
  plot{T<:Union{DataType,Function}}(!Matched::Array{T<:Union{DataType,Function},1}, ::Any, !Matched::Any, !Matched::Union{DataType,Function,Gadfly.Element,Gadfly.Theme}...)
  ...
while loading In[16], in expression starting on line 1

 in plot_histogram at In[15]:3

In [22]:
hist(lp)


LoadError: MethodError: `hist` has no method matching hist(::Distributions.Laplace)
while loading In[22], in expression starting on line 1

In [13]:
hist(epsilon_values)


Out[13]:
(-3.0:1.0:3.0,[3,10,39,35,11,2])

In [ ]: