Intermediate Regression with statsmodels in Python
Maarten Van den Broeck
Content Developer at DataCamp
from scipy.stats import norm
x = np.arange(-4, 4.05, 0.05)
gauss_dist = pd.DataFrame({
"x": x,
"gauss_pdf": norm.pdf(x)}
)
sns.lineplot(x="x",
y="gauss_pdf",
data=gauss_dist)
x = np.arange(-4, 4.05, 0.05)
gauss_dist = pd.DataFrame({
"x": x,
"gauss_pdf": norm.pdf(x),
"gauss_cdf": norm.cdf(x)}
)
sns.lineplot(x="x",
y="gauss_cdf",
data=gauss_dist)
x = np.arange(-4, 4.05, 0.05)
gauss_dist = pd.DataFrame({
"x": x,
"gauss_pdf": norm.pdf(x),
"gauss_cdf": norm.cdf(x)}
)
sns.lineplot(x="x",
y="gauss_cdf",
data=gauss_dist)
p = np.arange(0.001, 1, 0.001)
gauss_dist_inv = pd.DataFrame({
"p": p,
"gauss_inv_cdf": norm.ppf(p)}
)
sns.lineplot(x="p",
y="gauss_inv_cdf",
data=gauss_dist_inv)
from scipy.stats import logistic
x = np.arange(-4, 4.05, 0.05)
logistic_dist = pd.DataFrame({
"x": x,
"log_pdf": logistic.pdf(x)}
)
sns.lineplot(x="x",
y="log_pdf",
data=logistic_dist)
$\text{cdf}(x) = \frac{1}{(1 + exp(-x))}$
Logistic distribution inverse CDF is also called the logit function.
Intermediate Regression with statsmodels in Python