using Pkg; Pkg.activate("../."); Pkg.instantiate(); using IJulia; try IJulia.clear_output(); catch _ end using Plots using LaTeXStrings f(y,θ) = θ.^y .* (1 .- θ).^(1 .- y) # p(y|θ) θ = 0.5 p1 = plot([0,1], f([0,1], θ), line=:stem, marker=:circle, xrange=(-0.5, 1.5), yrange=(0,1), title="Sampling Distribution", xlabel="y", ylabel=L"p(y|θ=%$θ)", label="") _θ = 0:0.01:1 y=1 p2 = plot(_θ, f(y, _θ), ylabel=L"p(y=%$y | θ)", xlabel=L"θ", title="Likelihood Function", label="") plot(p1, p2) using Plots, Distributions, LaTeXStrings μx = 2. σx = 1. μy = 2. σy = 0.5 μz = μx+μy; σz = sqrt(σx^2 + σy^2) x = Normal(μx, σx) y = Normal(μy, σy) z = Normal(μz, σz) range_min = minimum([μx-2*σx, μy-2*σy, μz-2*σz]) range_max = maximum([μx+2*σx, μy+2*σy, μz+2*σz]) range_grid = range(range_min, stop=range_max, length=100) plot(range_grid, pdf.(x,range_grid), label=L"p_x", fill=(0, 0.1)) plot!(range_grid, pdf.(y,range_grid), label=L"p_y", fill=(0, 0.1)) plot!(range_grid, pdf.(z,range_grid), label=L"p_z", fill=(0, 0.1)) open("../../styles/aipstyle.html") do f display("text/html", read(f,String)) end