From 45f90f131c11be8dfe9a436bfc2146c0bff15a0a Mon Sep 17 00:00:00 2001 From: aaaakshat <33050725+aaaakshat@users.noreply.github.com> Date: Wed, 27 Oct 2021 12:18:52 -0400 Subject: [PATCH] Visualise the likelihood function --- ch08.r | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 ch08.r diff --git a/ch08.r b/ch08.r new file mode 100644 index 0000000..b308eee --- /dev/null +++ b/ch08.r @@ -0,0 +1,20 @@ +############# +# Chapter 8.1 Maximum-likelihood Estimation + +## Visualizing the likelihood function + +# R: Visualize the likelooh function +library(pracma) +library(plot3D) + +N = 50 +S = 1:N +theta = seq(0.1, 0.9, (0.9+0.1)/100) +mesh = meshgrid(S, theta) +S_grid = mesh$X +theta_grid = mesh$Y +L = S_grid * log(theta_grid) + (N-S_grid) * log(1-theta_grid) +L = t(L) +persp3D(S, theta, L, theta=65, phi=15) + +#############