I’m interested in plotting the level curves of a surface onto the xy plane. Here is an example of what I want to achieve
I’ve got some code to make the surface and plot it already. How can I modify my code to get my desired result?
using Plots
using LinearAlgebra
using Distributions
pyplot()
function expit(x)
1.0 / (1.0 + exp(-x))
end
function make_data()
N,p = 1000, 2
μ = zeros(p)
X = rand(Normal(), N)
X = [ones(N) X]
β = [-0.8, 0.2]
η = X*β;
θ = expit.(η)
dgp = Binomial.(1,θ)
y = rand.(dgp);
X,y
end
X, y = make_data();
function LL(b0, b1, X, y)
density = Binomial.(1, expit.(X*[b0,b1]))
sum(loglikelihood.(density, y))
end
b1 = -8:0.1:8
b0 = -8:0.1:8
z = [LL(i,j,X,y) for i in b0, j in b1];
plot(b0, b1, z, st = :surface, camera = (-30, 15))