This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# python code for reproduce figure 8.3, chapter 8, book: Intro to Probability for Data Science | |
# https://probability4datascience.com/python08.html | |
import numpy as np | |
import matplotlib.pyplot as plt | |
from mpl_toolkits import mplot3d | |
from mpl_toolkits.axes_grid1 import make_axes_locatable | |
# Bernoulli log-likelihood sequence | |
N = 50 | |
S = np.linspace(0, N) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
library(ISLR) | |
# prepare data example | |
df <- ISLR::Hitters[, c("Salary", "Years")] | |
row.names(df) <- NULL | |
df$Salary <- log(df$Salary) | |
# remove the observation with missing values in the response variable | |
df <- df[!is.na(df$Salary), ] | |
x <- df$Years |