Load Julia packages (libraries) needed for the snippets in chapter 0
using StatisticalRethinking
gr(size=(300, 300))Plots.GRBackend()snippet 0.1
println( "All models are wrong, but some are useful." )All models are wrong, but some are useful.snippet 0.2
This is a StepRange, not a vector
x = 1:31:3Below still preserves the StepRange
x = x*1010:10:30Broadcast log to steprange elements in x, this returms a vector! Notice the log.(x) notation.
x = log.(x)3-element Array{Float64,1}:
2.302585092994046
2.995732273553991
3.4011973816621555We can sum the vector x
x = sum(x)8.699514748210193Etc.
x = exp(x)
x = x*10
x = log(x)
x = sum(x)
x = exp(x)60000.00000000002snippet 0.3
[log(0.01^200) 200 * log(0.01)]1×2 Array{Float64,2}:
-Inf -921.034This page was generated using Literate.jl.