예제 #1
0
    def arange_samplesize():
        # シード値の固定
        np.random.seed(1)
        # samplesize=10
        size_10 = f.sigma_calc(size=10, n_trial=10000)
        size_10_df = pd.DataFrame({
            "list_mean": size_10.create_source(),
            "size": np.tile("size 10", 10000)
        })
        # samplesize=20
        size_20 = f.sigma_calc(size=20, n_trial=10000)
        size_20_df = pd.DataFrame({
            "list_mean": size_20.create_source(),
            "size": np.tile("size 20", 10000)
        })
        # samplesize=30
        size_30 = f.sigma_calc(size=30, n_trial=10000)
        size_30_df = pd.DataFrame({
            "list_mean": size_30.create_source(),
            "size": np.tile("size 30", 10000)
        })

        # 結合
        sim_result = pd.concat([size_10_df, size_20_df, size_30_df])
        # print(sim_result.head())

        # グラフの表示
        title = "arange_samplesize_graph"
        plt.title(title)
        graph = sns.violinplot(x="size",
                               y="list_mean",
                               data=sim_result,
                               color="gray")
        canvas = f.image_graph(graph, title)
        canvas.view_option(me="", st="", va="")
예제 #2
0
 def err_conf():
     elist = np.arange(start=2, stop=102, step=2)
     box = np.zeros(len(elist))
     for i in range(0, len(elist)):
         a = f.sigma_calc(size=10, n_trial=10)
         box[i] = sp.mean(a.create_source())
     print(box)
예제 #3
0
    def sigma_standard_error():
        # prepare
        spm = np.arange(start=2, stop=102, step=2)
        std_box = np.zeros(len(spm))
        # 単純な計算式
        st_err_1 = 0.8 / np.sqrt(spm)
        # 標本平均の標準偏差
        np.random.seed(1)
        for i in range(0, len(spm)):
            tmp = f.sigma_calc(size=spm[i], n_trial=100)
            std_box[i] = sp.std(tmp.create_source(), ddof=1)
        # 変数の確認用
        def var_conf(v):
            print(v)

        # var_conf(std_box) # コメントアウト推奨

        # 標本平均の標準偏差と標準誤差のグラフ
        title = "sigma_standard_error_graph"
        plt.title(title)
        graph = plt.plot(spm, std_box, color="black")
        graph = plt.plot(spm, st_err_1, linestyle="dotted", color="black")
        graph = plt.xlabel("smaple_size")
        graph = plt.ylabel("mean_std_value")
        canvas = f.image_graph(dt_graph=graph, dt_name=title)
        canvas.view_option(me="", st="", va="")
예제 #4
0
 def sigma_mean_deviation():
     # prepare
     base_samplesize = np.arange(start=2, stop=102, step=2)
     base_box = np.zeros(len(base_samplesize))
     # シード値の固定
     np.random.seed(1)
     for i in range(0, len(base_samplesize)):
         tmp_box = f.sigma_calc(size=base_samplesize[i], n_trial=100)
         base_box[i] = sp.std(tmp_box.create_source(), ddof=1)
     # グラフの描写
     title = "sigma_mean_deviation_graph"
     plt.title(title)
     graph = plt.plot(base_samplesize, base_box, color="black")
     graph = plt.xlabel("base_samplesize")
     graph = plt.ylabel("base_box")
     canvas = f.image_graph(graph, title)
     canvas.view_option(me="", st="", va="")
예제 #5
0
 def debug():
     np.random.seed(1)
     t = f.sigma_calc(size=10, n_trial=10)
     tf = f.list_format(lv=1, data=t.create_source_var())
     print(tf.format())
예제 #6
0
 def var_check():
     np.random.seed(1)
     var = f.sigma_calc(size=10, n_trial=10000)
     var_f = f.list_format(lv=1, data=var.create_source_var())
예제 #7
0
 def exe_conf():
     # np.random.seed(1)
     test = f.sigma_calc(size=10, n_trial=10000)
     print(test.create_source())
     print(f'{sp.mean(test.create_source()):.3f}')