$ \mathit{log} \Phi(x)$ は concaveか?


In [2]:
%matplotlib inline
import math
import numpy as np
import pandas as pd
import matplotlib as mpl
import matplotlib.pyplot as plt
import csv
import scipy.stats as st
np.set_printoptions(precision=5)
plt.rcParams['font.size'] = 13
# 日本語対応
mpl.rcParams['font.family'] = 'Osaka'

In [9]:
xgrid = np.linspace(-10, 10, 1001)
y = st.norm.cdf(x=xgrid, loc=0, scale=1)

fig, axes = plt.subplots(figsize=(16, 8))
plt.plot(xgrid, y, label="st normal cdf")
plt.show()



In [15]:
log_y = np.log(y)

fig, ax = plt.subplots(figsize=(12, 8))
plt.plot(xgrid, log_y, label="log st normal cdf")
ax.set_ylim([-60, 10])
plt.legend()
plt.show()



In [26]:
p_list = [0.01, 0.001, 0.0001]
xgrid = np.arange(0, 100)
func = lambda p, n: 1 - np.power(1-p, n)

fig, axes = plt.subplots(figsize=(16, 8))
for p in p_list:
    plt.plot(xgrid, func(p, xgrid) * 100, label="1個あたり当たる確率p={}%".format(p*100))

plt.xlabel("個数")
plt.ylabel("当たる確率(%)")
plt.legend(loc="upper left")
plt.show()



In [90]:
xgrid = np.linspace(-10, 10, 101)
pdf = st.norm.pdf(x=xgrid, loc=0, scale=1)
cdf = st.norm.cdf(x=xgrid, loc=0, scale=1)

d_log_y = pdf / cdf

fig, ax = plt.subplots(figsize=(12, 8))
plt.plot(xgrid, d_log_y, label="pdf / cdf")
ax.set_ylim([-10, 10])
plt.legend()
plt.show()



In [72]:
xgrid = np.linspace(-10, 10, 1001)
pdf = st.norm.pdf(x=xgrid, loc=0, scale=1)
cdf = st.norm.cdf(x=xgrid, loc=0, scale=1)

d3_log_y = (np.power(xgrid, 2)-1) * np.power(cdf, 2) \
    + 3 * xgrid * pdf * cdf \
    + 2 * np.power(pdf, 2)

fig, ax = plt.subplots(figsize=(12, 8))
plt.plot(xgrid, d3_log_y, label="something")
ax.set_ylim([-0.5, 1])
plt.legend()
plt.show()



In [5]:
xgrid = np.linspace(-10, 10, 1001)
pdf = st.norm.pdf(x=xgrid, loc=0, scale=1)
cdf = st.norm.cdf(x=xgrid, loc=0, scale=1)

lm = pdf / cdf[::-1]
lb = xgrid + 1 / xgrid
lb2 = xgrid

fig, ax = plt.subplots(figsize=(12, 8))
plt.plot(xgrid, lm, label="pdf / cdf")
plt.plot(xgrid, lb, label="something")
plt.plot(xgrid, lb2, label="something2")
ax.set_ylim([0, 10])
plt.legend()
plt.show()



In [9]:
xgrid = np.linspace(-10, 10, 1001)
pdf = st.norm.pdf(x=xgrid, loc=0, scale=1)
cdf = st.norm.cdf(x=xgrid, loc=0, scale=1)

lm = pdf / cdf[::-1]
lb = 2 * lm - xgrid

fig, ax = plt.subplots(figsize=(12, 8))
plt.plot(xgrid, lm, label="pdf / cdf")
plt.plot(xgrid, lb, label="something")
ax.set_ylim([0, 10])
plt.legend()
plt.show()



In [ ]: