{ "cells": [ { "cell_type": "code", "execution_count": 1, "metadata": {}, "outputs": [], "source": [ "using Distributions\n", "using StatsBase\n", "using CSV\n", "using DataFrames\n", "using HypothesisTests\n", "using Plots\n", "using GLM" ] }, { "cell_type": "code", "execution_count": 2, "metadata": {}, "outputs": [], "source": [ "test1 = CSV.read(\"ProjectData_1_point_0.csv\");" ] }, { "cell_type": "code", "execution_count": 3, "metadata": {}, "outputs": [ { "data": { "text/html": [ "

100 rows × 5 columns

AgeWCCCRPTreatmentResult
Int64Float64Int64StringString
1399.310AWorse
25114.650AWorse
3757.150AImproved
45912.010AImproved
56213.660AStatic
65911.930BStatic
73110.610BStatic
86311.870AWorse
94113.270AWorse
104513.690BWorse
117811.870BImproved
123613.750AImproved
13629.540AStatic
143413.630AStatic
157014.290AStatic
165412.930AImproved
171812.320BWorse
187811.030AImproved
195312.760BWorse
205315.5100AStatic
216611.470AWorse
228012.120BStatic
234610.370BImproved
245810.920BImproved
256812.220BImproved
26588.320BWorse
272011.740AWorse
283814.860AImproved
297612.430BImproved
30234.940BStatic
" ], "text/latex": [ "\\begin{tabular}{r|ccccc}\n", "\t& Age & WCC & CRP & Treatment & Result\\\\\n", "\t\\hline\n", "\t& Int64 & Float64 & Int64 & String & String\\\\\n", "\t\\hline\n", "\t1 & 39 & 9.3 & 10 & A & Worse \\\\\n", "\t2 & 51 & 14.6 & 50 & A & Worse \\\\\n", "\t3 & 75 & 7.1 & 50 & A & Improved \\\\\n", "\t4 & 59 & 12.0 & 10 & A & Improved \\\\\n", "\t5 & 62 & 13.6 & 60 & A & Static \\\\\n", "\t6 & 59 & 11.9 & 30 & B & Static \\\\\n", "\t7 & 31 & 10.6 & 10 & B & Static \\\\\n", "\t8 & 63 & 11.8 & 70 & A & Worse \\\\\n", "\t9 & 41 & 13.2 & 70 & A & Worse \\\\\n", "\t10 & 45 & 13.6 & 90 & B & Worse \\\\\n", "\t11 & 78 & 11.8 & 70 & B & Improved \\\\\n", "\t12 & 36 & 13.7 & 50 & A & Improved \\\\\n", "\t13 & 62 & 9.5 & 40 & A & Static \\\\\n", "\t14 & 34 & 13.6 & 30 & A & Static \\\\\n", "\t15 & 70 & 14.2 & 90 & A & Static \\\\\n", "\t16 & 54 & 12.9 & 30 & A & Improved \\\\\n", "\t17 & 18 & 12.3 & 20 & B & Worse \\\\\n", "\t18 & 78 & 11.0 & 30 & A & Improved \\\\\n", "\t19 & 53 & 12.7 & 60 & B & Worse \\\\\n", "\t20 & 53 & 15.5 & 100 & A & Static \\\\\n", "\t21 & 66 & 11.4 & 70 & A & Worse \\\\\n", "\t22 & 80 & 12.1 & 20 & B & Static \\\\\n", "\t23 & 46 & 10.3 & 70 & B & Improved \\\\\n", "\t24 & 58 & 10.9 & 20 & B & Improved \\\\\n", "\t25 & 68 & 12.2 & 20 & B & Improved \\\\\n", "\t26 & 58 & 8.3 & 20 & B & Worse \\\\\n", "\t27 & 20 & 11.7 & 40 & A & Worse \\\\\n", "\t28 & 38 & 14.8 & 60 & A & Improved \\\\\n", "\t29 & 76 & 12.4 & 30 & B & Improved \\\\\n", "\t30 & 23 & 4.9 & 40 & B & Static \\\\\n", "\t$\\dots$ & $\\dots$ & $\\dots$ & $\\dots$ & $\\dots$ & $\\dots$ \\\\\n", "\\end{tabular}\n" ], "text/plain": [ "100×5 DataFrame\n", "│ Row │ Age │ WCC │ CRP │ Treatment │ Result │\n", "│ │ \u001b[90mInt64\u001b[39m │ \u001b[90mFloat64\u001b[39m │ \u001b[90mInt64\u001b[39m │ \u001b[90mString\u001b[39m │ \u001b[90mString\u001b[39m │\n", "├─────┼───────┼─────────┼───────┼───────────┼──────────┤\n", "│ 1 │ 39 │ 9.3 │ 10 │ A │ Worse │\n", "│ 2 │ 51 │ 14.6 │ 50 │ A │ Worse │\n", "│ 3 │ 75 │ 7.1 │ 50 │ A │ Improved │\n", "│ 4 │ 59 │ 12.0 │ 10 │ A │ Improved │\n", "│ 5 │ 62 │ 13.6 │ 60 │ A │ Static │\n", "│ 6 │ 59 │ 11.9 │ 30 │ B │ Static │\n", "│ 7 │ 31 │ 10.6 │ 10 │ B │ Static │\n", "│ 8 │ 63 │ 11.8 │ 70 │ A │ Worse │\n", "│ 9 │ 41 │ 13.2 │ 70 │ A │ Worse │\n", "│ 10 │ 45 │ 13.6 │ 90 │ B │ Worse │\n", "⋮\n", "│ 90 │ 43 │ 12.5 │ 10 │ A │ Improved │\n", "│ 91 │ 51 │ 14.1 │ 50 │ A │ Worse │\n", "│ 92 │ 35 │ 10.2 │ 40 │ B │ Static │\n", "│ 93 │ 52 │ 13.7 │ 70 │ A │ Worse │\n", "│ 94 │ 33 │ 11.2 │ 20 │ A │ Improved │\n", "│ 95 │ 30 │ 12.5 │ 110 │ A │ Worse │\n", "│ 96 │ 60 │ 12.6 │ 30 │ A │ Static │\n", "│ 97 │ 25 │ 13.0 │ 20 │ B │ Static │\n", "│ 98 │ 76 │ 7.1 │ 10 │ A │ Static │\n", "│ 99 │ 54 │ 16.1 │ 50 │ B │ Improved │\n", "│ 100 │ 36 │ 11.8 │ 10 │ A │ Worse │" ] }, "execution_count": 3, "metadata": {}, "output_type": "execute_result" } ], "source": [ "test1" ] }, { "cell_type": "code", "execution_count": 4, "metadata": {}, "outputs": [ { "data": { "text/html": [ "

20 rows × 3 columns

GroupVariable1Variable2
StringFloat64Float64
1B-0.3951640.785108
2A-0.4779110.94664
3B1.32480.683507
4A2.189450.655638
5B-1.80220.40504
6B-0.04153390.0649169
7A-0.9887760.579329
8B0.4522460.0049928
9B-1.230540.529847
10A-0.9233780.258118
11B0.8744760.642472
12A-1.020090.0728385
13B-0.4221060.319547
14B0.9537260.0257164
15A-2.524170.0487641
16B0.4949370.869764
17A1.477040.824756
18A-0.1333670.875263
19B-0.9062930.0709776
20B-0.366590.452148
" ], "text/latex": [ "\\begin{tabular}{r|ccc}\n", "\t& Group & Variable1 & Variable2\\\\\n", "\t\\hline\n", "\t& String & Float64 & Float64\\\\\n", "\t\\hline\n", "\t1 & B & -0.395164 & 0.785108 \\\\\n", "\t2 & A & -0.477911 & 0.94664 \\\\\n", "\t3 & B & 1.3248 & 0.683507 \\\\\n", "\t4 & A & 2.18945 & 0.655638 \\\\\n", "\t5 & B & -1.8022 & 0.40504 \\\\\n", "\t6 & B & -0.0415339 & 0.0649169 \\\\\n", "\t7 & A & -0.988776 & 0.579329 \\\\\n", "\t8 & B & 0.452246 & 0.0049928 \\\\\n", "\t9 & B & -1.23054 & 0.529847 \\\\\n", "\t10 & A & -0.923378 & 0.258118 \\\\\n", "\t11 & B & 0.874476 & 0.642472 \\\\\n", "\t12 & A & -1.02009 & 0.0728385 \\\\\n", "\t13 & B & -0.422106 & 0.319547 \\\\\n", "\t14 & B & 0.953726 & 0.0257164 \\\\\n", "\t15 & A & -2.52417 & 0.0487641 \\\\\n", "\t16 & B & 0.494937 & 0.869764 \\\\\n", "\t17 & A & 1.47704 & 0.824756 \\\\\n", "\t18 & A & -0.133367 & 0.875263 \\\\\n", "\t19 & B & -0.906293 & 0.0709776 \\\\\n", "\t20 & B & -0.36659 & 0.452148 \\\\\n", "\\end{tabular}\n" ], "text/plain": [ "20×3 DataFrame\n", "│ Row │ Group │ Variable1 │ Variable2 │\n", "│ │ \u001b[90mString\u001b[39m │ \u001b[90mFloat64\u001b[39m │ \u001b[90mFloat64\u001b[39m │\n", "├─────┼────────┼────────────┼───────────┤\n", "│ 1 │ B │ -0.395164 │ 0.785108 │\n", "│ 2 │ A │ -0.477911 │ 0.94664 │\n", "│ 3 │ B │ 1.3248 │ 0.683507 │\n", "│ 4 │ A │ 2.18945 │ 0.655638 │\n", "│ 5 │ B │ -1.8022 │ 0.40504 │\n", "│ 6 │ B │ -0.0415339 │ 0.0649169 │\n", "│ 7 │ A │ -0.988776 │ 0.579329 │\n", "│ 8 │ B │ 0.452246 │ 0.0049928 │\n", "│ 9 │ B │ -1.23054 │ 0.529847 │\n", "│ 10 │ A │ -0.923378 │ 0.258118 │\n", "│ 11 │ B │ 0.874476 │ 0.642472 │\n", "│ 12 │ A │ -1.02009 │ 0.0728385 │\n", "│ 13 │ B │ -0.422106 │ 0.319547 │\n", "│ 14 │ B │ 0.953726 │ 0.0257164 │\n", "│ 15 │ A │ -2.52417 │ 0.0487641 │\n", "│ 16 │ B │ 0.494937 │ 0.869764 │\n", "│ 17 │ A │ 1.47704 │ 0.824756 │\n", "│ 18 │ A │ -0.133367 │ 0.875263 │\n", "│ 19 │ B │ -0.906293 │ 0.0709776 │\n", "│ 20 │ B │ -0.36659 │ 0.452148 │" ] }, "execution_count": 4, "metadata": {}, "output_type": "execute_result" } ], "source": [ "DataFrame(Group=rand([\"A\", \"B\"], 20), Variable1=randn(20), Variable2=rand(20))" ] }, { "cell_type": "code", "execution_count": 5, "metadata": {}, "outputs": [ { "data": { "text/html": [ "

DataFrameRow (5 columns)

AgeWCCCRPTreatmentResult
Int64Float64Int64StringString
3757.150AImproved
" ], "text/latex": [ "\\begin{tabular}{r|ccccc}\n", "\t& Age & WCC & CRP & Treatment & Result\\\\\n", "\t\\hline\n", "\t& Int64 & Float64 & Int64 & String & String\\\\\n", "\t\\hline\n", "\t3 & 75 & 7.1 & 50 & A & Improved \\\\\n", "\\end{tabular}\n" ], "text/plain": [ "DataFrameRow\n", "│ Row │ Age │ WCC │ CRP │ Treatment │ Result │\n", "│ │ \u001b[90mInt64\u001b[39m │ \u001b[90mFloat64\u001b[39m │ \u001b[90mInt64\u001b[39m │ \u001b[90mString\u001b[39m │ \u001b[90mString\u001b[39m │\n", "├─────┼───────┼─────────┼───────┼───────────┼──────────┤\n", "│ 3 │ 75 │ 7.1 │ 50 │ A │ Improved │" ] }, "execution_count": 5, "metadata": {}, "output_type": "execute_result" } ], "source": [ "view(test1,3,:)" ] }, { "cell_type": "code", "execution_count": 17, "metadata": {}, "outputs": [ { "data": { "text/html": [ "

97 rows × 5 columns

AgeWCCCRPTreatmentResult
Int64Float64Int64StringString
1399.310AWorse
25114.650AWorse
35912.010AImproved
45911.930BStatic
53110.610BStatic
66311.870AWorse
74513.690BWorse
87811.870BImproved
93613.750AImproved
10629.540AStatic
113413.630AStatic
127014.290AStatic
135412.930AImproved
141812.320BWorse
157811.030AImproved
165312.760BWorse
175315.5100AStatic
186611.470AWorse
198012.120BStatic
204610.370BImproved
215810.920BImproved
226812.220BImproved
23588.320BWorse
242011.740AWorse
253814.860AImproved
267612.430BImproved
27234.940BStatic
288013.780BStatic
296512.410BImproved
302214.710BImproved
" ], "text/latex": [ "\\begin{tabular}{r|ccccc}\n", "\t& Age & WCC & CRP & Treatment & Result\\\\\n", "\t\\hline\n", "\t& Int64 & Float64 & Int64 & String & String\\\\\n", "\t\\hline\n", "\t1 & 39 & 9.3 & 10 & A & Worse \\\\\n", "\t2 & 51 & 14.6 & 50 & A & Worse \\\\\n", "\t3 & 59 & 12.0 & 10 & A & Improved \\\\\n", "\t4 & 59 & 11.9 & 30 & B & Static \\\\\n", "\t5 & 31 & 10.6 & 10 & B & Static \\\\\n", "\t6 & 63 & 11.8 & 70 & A & Worse \\\\\n", "\t7 & 45 & 13.6 & 90 & B & Worse \\\\\n", "\t8 & 78 & 11.8 & 70 & B & Improved \\\\\n", "\t9 & 36 & 13.7 & 50 & A & Improved \\\\\n", "\t10 & 62 & 9.5 & 40 & A & Static \\\\\n", "\t11 & 34 & 13.6 & 30 & A & Static \\\\\n", "\t12 & 70 & 14.2 & 90 & A & Static \\\\\n", "\t13 & 54 & 12.9 & 30 & A & Improved \\\\\n", "\t14 & 18 & 12.3 & 20 & B & Worse \\\\\n", "\t15 & 78 & 11.0 & 30 & A & Improved \\\\\n", "\t16 & 53 & 12.7 & 60 & B & Worse \\\\\n", "\t17 & 53 & 15.5 & 100 & A & Static \\\\\n", "\t18 & 66 & 11.4 & 70 & A & Worse \\\\\n", "\t19 & 80 & 12.1 & 20 & B & Static \\\\\n", "\t20 & 46 & 10.3 & 70 & B & Improved \\\\\n", "\t21 & 58 & 10.9 & 20 & B & Improved \\\\\n", "\t22 & 68 & 12.2 & 20 & B & Improved \\\\\n", "\t23 & 58 & 8.3 & 20 & B & Worse \\\\\n", "\t24 & 20 & 11.7 & 40 & A & Worse \\\\\n", "\t25 & 38 & 14.8 & 60 & A & Improved \\\\\n", "\t26 & 76 & 12.4 & 30 & B & Improved \\\\\n", "\t27 & 23 & 4.9 & 40 & B & Static \\\\\n", "\t28 & 80 & 13.7 & 80 & B & Static \\\\\n", "\t29 & 65 & 12.4 & 10 & B & Improved \\\\\n", "\t30 & 22 & 14.7 & 10 & B & Improved \\\\\n", "\t$\\dots$ & $\\dots$ & $\\dots$ & $\\dots$ & $\\dots$ & $\\dots$ \\\\\n", "\\end{tabular}\n" ], "text/plain": [ "97×5 DataFrame\n", "│ Row │ Age │ WCC │ CRP │ Treatment │ Result │\n", "│ │ \u001b[90mInt64\u001b[39m │ \u001b[90mFloat64\u001b[39m │ \u001b[90mInt64\u001b[39m │ \u001b[90mString\u001b[39m │ \u001b[90mString\u001b[39m │\n", "├─────┼───────┼─────────┼───────┼───────────┼──────────┤\n", "│ 1 │ 39 │ 9.3 │ 10 │ A │ Worse │\n", "│ 2 │ 51 │ 14.6 │ 50 │ A │ Worse │\n", "│ 3 │ 59 │ 12.0 │ 10 │ A │ Improved │\n", "│ 4 │ 59 │ 11.9 │ 30 │ B │ Static │\n", "│ 5 │ 31 │ 10.6 │ 10 │ B │ Static │\n", "│ 6 │ 63 │ 11.8 │ 70 │ A │ Worse │\n", "│ 7 │ 45 │ 13.6 │ 90 │ B │ Worse │\n", "│ 8 │ 78 │ 11.8 │ 70 │ B │ Improved │\n", "│ 9 │ 36 │ 13.7 │ 50 │ A │ Improved │\n", "│ 10 │ 62 │ 9.5 │ 40 │ A │ Static │\n", "⋮\n", "│ 87 │ 43 │ 12.5 │ 10 │ A │ Improved │\n", "│ 88 │ 51 │ 14.1 │ 50 │ A │ Worse │\n", "│ 89 │ 35 │ 10.2 │ 40 │ B │ Static │\n", "│ 90 │ 52 │ 13.7 │ 70 │ A │ Worse │\n", "│ 91 │ 33 │ 11.2 │ 20 │ A │ Improved │\n", "│ 92 │ 30 │ 12.5 │ 110 │ A │ Worse │\n", "│ 93 │ 60 │ 12.6 │ 30 │ A │ Static │\n", "│ 94 │ 25 │ 13.0 │ 20 │ B │ Static │\n", "│ 95 │ 76 │ 7.1 │ 10 │ A │ Static │\n", "│ 96 │ 54 │ 16.1 │ 50 │ B │ Improved │\n", "│ 97 │ 36 │ 11.8 │ 10 │ A │ Worse │" ] }, "execution_count": 17, "metadata": {}, "output_type": "execute_result" } ], "source": [ "test1[[1:2;4:4;6:8;10:end],:]" ] }, { "cell_type": "code", "execution_count": 19, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "101.20293783633616" ] }, "execution_count": 19, "metadata": {}, "output_type": "execute_result" } ], "source": [ "var(rand(Normal(80, 10), 200))" ] }, { "cell_type": "code", "execution_count": 21, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "-0.0520584551299503" ] }, "execution_count": 21, "metadata": {}, "output_type": "execute_result" } ], "source": [ "mean(randn(100))" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "TDist()" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "EqualVarianceTTest()" ] } ], "metadata": { "kernelspec": { "display_name": "Julia 1.2.0", "language": "julia", "name": "julia-1.2" }, "language_info": { "file_extension": ".jl", "mimetype": "application/julia", "name": "julia", "version": "1.2.0" } }, "nbformat": 4, "nbformat_minor": 4 }