Skip to content

Commit

Permalink
Visualise the likelihood function
Browse files Browse the repository at this point in the history
  • Loading branch information
aaaakshat committed Nov 3, 2021
1 parent 0dbcb9f commit 45f90f1
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions ch08.r
Original file line number Diff line number Diff line change
@@ -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)

#############

0 comments on commit 45f90f1

Please sign in to comment.