Skip to content

Instantly share code, notes, and snippets.

@briochemc
Created September 15, 2020 13:08
Show Gist options
  • Save briochemc/91e73b9a8a84cd734f5fc6856224ed46 to your computer and use it in GitHub Desktop.
Save briochemc/91e73b9a8a84cd734f5fc6856224ed46 to your computer and use it in GitHub Desktop.
### A Pluto.jl notebook ###
# v0.11.14
using Markdown
using InteractiveUtils
# This Pluto notebook uses @bind for interactivity. When running this notebook outside of Pluto, the following 'mock version' of @bind gives bound variables a default value (instead of an error).
macro bind(def, element)
quote
local el = $(esc(element))
global $(esc(def)) = Core.applicable(Base.get, el) ? Base.get(el) : missing
el
end
end
# ╔═╡ 61b6011c-f746-11ea-2188-ad076b58c445
using PlutoUI, StatsPlots, Random, Distributions, GLM, DataFrames
# ╔═╡ 6658871c-f746-11ea-1bd8-8d2ba001a965
md"""
\# samples
$(@bind ndata Slider(3:5000, default=100, show_value=true))
correlation
$(@bind corr Slider(-.999:0.001:0.999, default=0, show_value=true))
"""
# ╔═╡ 23920950-f747-11ea-325b-617fc2e28c56
begin
Σ = [1.0 corr
corr 1.0]
D = Distributions.MvNormal(Σ)
df = DataFrame(rand(D, ndata)', [:x1, :x2])
linear_model = lm(@formula(x1 ~ x2), df)
end
# ╔═╡ b841f27e-f751-11ea-3c67-fd65b9e700ff
@df df cornerplot(cols(1:2), compact=true, ms=3)
# ╔═╡ Cell order:
# ╠═61b6011c-f746-11ea-2188-ad076b58c445
# ╠═6658871c-f746-11ea-1bd8-8d2ba001a965
# ╠═23920950-f747-11ea-325b-617fc2e28c56
# ╠═b841f27e-f751-11ea-3c67-fd65b9e700ff
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment