From efe80b58777f792ecbbe44de44d5a68acc229e74 Mon Sep 17 00:00:00 2001 From: SkylarShi Date: Mon, 27 May 2024 12:20:04 -0700 Subject: [PATCH] Deploy website - based on 6229f9b1fab8bb8d158f8d08fbde30c5c40907c0 --- 404.html | 2 +- .../js/{60c4aef6.62dc7b2e.js => 60c4aef6.e958a07e.js} | 2 +- assets/js/9f1843d8.3bede0c7.js | 1 + assets/js/9f1843d8.8fe7c9be.js | 1 - assets/js/f03ae67e.11dc796d.js | 1 - assets/js/f03ae67e.db78e148.js | 1 + ...ntime~main.a9a9ad25.js => runtime~main.9fa575ec.js} | 2 +- blog/archive/index.html | 2 +- blog/first-blog-post/index.html | 2 +- blog/index.html | 2 +- blog/long-blog-post/index.html | 2 +- blog/mdx-blog-post/index.html | 2 +- blog/tags/docusaurus/index.html | 2 +- blog/tags/facebook/index.html | 2 +- blog/tags/hello/index.html | 2 +- blog/tags/hola/index.html | 2 +- blog/tags/index.html | 2 +- blog/welcome/index.html | 2 +- docs/category/if-statements/index.html | 2 +- docs/category/querying/index.html | 2 +- .../Functions/Applying Functions/index.html | 2 +- .../Functions/Writing Functions/index.html | 2 +- .../Grouping/aggregation/count()/index.html | 2 +- .../Grouping/aggregation/max()/index.html | 2 +- .../Grouping/aggregation/mean()/index.html | 2 +- .../Grouping/aggregation/median()/index.html | 2 +- .../Grouping/aggregation/min()/index.html | 2 +- .../Grouping/aggregation/sum()/index.html | 2 +- docs/documentation/Grouping/groupby/index.html | 2 +- .../documentation/accessing-data/df.columns/index.html | 2 +- docs/documentation/accessing-data/df.get()/index.html | 2 +- docs/documentation/accessing-data/df.index/index.html | 2 +- docs/documentation/accessing-data/df.shape/index.html | 2 +- docs/documentation/accessing-data/df.take()/index.html | 2 +- docs/documentation/accessing-data/index.html | 2 +- .../documentation/accessing-data/ser.iloc[]/index.html | 2 +- docs/documentation/accessing-data/ser.loc[]/index.html | 2 +- docs/documentation/arrays-and-numpy/arr[]/index.html | 2 +- docs/documentation/arrays-and-numpy/index.html | 2 +- .../arrays-and-numpy/np.append()/index.html | 2 +- .../arrays-and-numpy/np.arange()/index.html | 2 +- .../arrays-and-numpy/np.count_nonzero()/index.html | 2 +- .../arrays-and-numpy/np.percentile()/index.html | 2 +- .../arrays-and-numpy/np.round()/index.html | 2 +- .../building-organizing/bpd.DataFrame()/index.html | 2 +- .../building-organizing/bpd.read_csv()/index.html | 2 +- .../building-organizing/df.assign()/index.html | 2 +- .../building-organizing/df.drop()/index.html | 2 +- .../building-organizing/df.merge()/index.html | 2 +- .../building-organizing/df.reset_index()/index.html | 2 +- .../building-organizing/df.set_index()/index.html | 2 +- .../building-organizing/df.sort_values()/index.html | 2 +- docs/documentation/building-organizing/index.html | 2 +- docs/documentation/data format conversion/index.html | 2 +- .../data format conversion/list()/index.html | 2 +- .../data format conversion/np.array()/index.html | 2 +- docs/documentation/for-loops/index.html | 2 +- .../if-statements/Logical Operators/index.html | 2 +- .../if-statements/if-elif-else/index.html | 2 +- .../if-statements/in \342\201\204 not in/index.html" | 2 +- docs/documentation/intro/index.html | 2 +- docs/documentation/plotting/Bar Plot/index.html | 2 +- docs/documentation/plotting/Histogram/index.html | 2 +- docs/documentation/plotting/Line Plot/index.html | 2 +- docs/documentation/plotting/Scatter Plot/index.html | 2 +- docs/documentation/plotting/index.html | 2 +- docs/documentation/querying/df[]/index.html | 2 +- docs/documentation/series-methods/index.html | 2 +- .../series-methods/ser.count()/index.html | 2 +- docs/documentation/series-methods/ser.max()/index.html | 2 +- .../documentation/series-methods/ser.mean()/index.html | 2 +- .../series-methods/ser.median()/index.html | 2 +- docs/documentation/series-methods/ser.min()/index.html | 2 +- .../series-methods/ser.str.capitalize()/index.html | 2 +- .../series-methods/ser.str.contains()/index.html | 2 +- .../series-methods/ser.str.len()/index.html | 2 +- .../series-methods/ser.str.lower()/index.html | 2 +- .../series-methods/ser.str.replace()/index.html | 2 +- .../series-methods/ser.str.split()/index.html | 2 +- .../series-methods/ser.str.strip()/index.html | 2 +- .../series-methods/ser.str.title()/index.html | 2 +- .../series-methods/ser.str.upper()/index.html | 2 +- docs/documentation/series-methods/ser.sum()/index.html | 2 +- .../series-methods/ser.unique()/index.html | 2 +- docs/statistical-inference/bootstrapping/index.html | 2 +- .../concept check/hypothesis_vs_permutation/index.html | 2 +- docs/statistical-inference/hypothesis_test/index.html | 10 ++++++---- docs/statistical-inference/intro/index.html | 2 +- docs/statistical-inference/null_and_alt/index.html | 2 +- .../obs_and_test_stats/index.html | 4 ++-- docs/statistical-inference/p_value/index.html | 2 +- .../parameters-and-statistics/index.html | 2 +- docs/statistical-inference/permutation_test/index.html | 10 +++++----- .../random sampling/np.random.choice()/index.html | 2 +- .../random sampling/sampling/index.html | 2 +- .../standard_normal_distribution/index.html | 2 +- docs/statistical-inference/standard_units/index.html | 2 +- docs/tags/for-loop/index.html | 2 +- docs/tags/functions/index.html | 2 +- docs/tags/histogram/index.html | 2 +- docs/tags/index.html | 2 +- docs/tags/normal-distributions/index.html | 2 +- docs/tags/querying/index.html | 2 +- docs/tags/standard-units/index.html | 2 +- index.html | 2 +- markdown-page/index.html | 2 +- search/index.html | 2 +- 107 files changed, 115 insertions(+), 113 deletions(-) rename assets/js/{60c4aef6.62dc7b2e.js => 60c4aef6.e958a07e.js} (59%) create mode 100644 assets/js/9f1843d8.3bede0c7.js delete mode 100644 assets/js/9f1843d8.8fe7c9be.js delete mode 100644 assets/js/f03ae67e.11dc796d.js create mode 100644 assets/js/f03ae67e.db78e148.js rename assets/js/{runtime~main.a9a9ad25.js => runtime~main.9fa575ec.js} (98%) diff --git a/404.html b/404.html index fde739fd..a6985ae2 100644 --- a/404.html +++ b/404.html @@ -11,7 +11,7 @@ - + diff --git a/assets/js/60c4aef6.62dc7b2e.js b/assets/js/60c4aef6.e958a07e.js similarity index 59% rename from assets/js/60c4aef6.62dc7b2e.js rename to assets/js/60c4aef6.e958a07e.js index 62da85eb..aedd8415 100644 --- a/assets/js/60c4aef6.62dc7b2e.js +++ b/assets/js/60c4aef6.e958a07e.js @@ -1 +1 @@ -"use strict";(self.webpackChunkbpd_reference=self.webpackChunkbpd_reference||[]).push([[6142],{3071:(e,t,n)=>{n.r(t),n.d(t,{assets:()=>l,contentTitle:()=>o,default:()=>h,frontMatter:()=>r,metadata:()=>a,toc:()=>d});var s=n(4848),i=n(8453);n(8597),n(5158);const r={sidebar_position:4,sidebar_label:"Observed & Test Statistic",title:"Observed & Test Statistic"},o=void 0,a={id:"statistical-inference/obs_and_test_stats",title:"Observed & Test Statistic",description:"Concept",source:"@site/docs/statistical-inference/obs_and_test_stats.md",sourceDirName:"statistical-inference",slug:"/statistical-inference/obs_and_test_stats",permalink:"/bpd-reference/docs/statistical-inference/obs_and_test_stats",draft:!1,unlisted:!1,editUrl:"https://github.com/dsc-courses/bpd-reference/tree/main/docs/statistical-inference/obs_and_test_stats.md",tags:[],version:"current",sidebarPosition:4,frontMatter:{sidebar_position:4,sidebar_label:"Observed & Test Statistic",title:"Observed & Test Statistic"},sidebar:"statsSidebar",previous:{title:"Null & Alternative Hypothesis",permalink:"/bpd-reference/docs/statistical-inference/null_and_alt"},next:{title:"P-value",permalink:"/bpd-reference/docs/statistical-inference/p_value"}},l={},d=[{value:"Concept",id:"concept",level:2},{value:"Common Test Statistic \ud83c\udf1f",id:"common-test-statistic-",level:2},{value:"1. Absolute Difference",id:"1-absolute-difference",level:3},{value:"2. Difference",id:"2-difference",level:3},{value:"3. Total Variation Distance (TVD)",id:"3-total-variation-distance-tvd",level:3}];function c(e){const t={admonition:"admonition",em:"em",h2:"h2",h3:"h3",li:"li",ol:"ol",p:"p",strong:"strong",ul:"ul",...(0,i.R)(),...e.components};return(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(t.h2,{id:"concept",children:"Concept"}),"\n",(0,s.jsxs)(t.admonition,{title:"Terminology",type:"info",children:[(0,s.jsxs)(t.p,{children:[(0,s.jsx)(t.strong,{children:"Experiment"}),": A process whose outcome is random."]}),(0,s.jsxs)(t.ul,{children:["\n",(0,s.jsx)(t.li,{children:"Example: flipping 100 coins."}),"\n"]}),(0,s.jsxs)(t.p,{children:[(0,s.jsx)(t.strong,{children:"Observed Statistic"}),": A statistic computed from the observed data."]}),(0,s.jsxs)(t.ul,{children:["\n",(0,s.jsx)(t.li,{children:"Example: The number of heads observed."}),"\n"]}),(0,s.jsxs)(t.p,{children:[(0,s.jsx)(t.strong,{children:"Test Statistic"}),": A statistic computed from a sample generated under the assumption that the null hypothesis is true."]}),(0,s.jsxs)(t.ul,{children:["\n",(0,s.jsx)(t.li,{children:"Think of the test statistic a number you write down each time you perform an experiment."}),"\n",(0,s.jsx)(t.li,{children:"The test statistic should be such that high observed values lean towards one hypothesis and low observed values lean towards the other."}),"\n"]})]}),"\n",(0,s.jsx)(t.h2,{id:"common-test-statistic-",children:"Common Test Statistic \ud83c\udf1f"}),"\n",(0,s.jsx)(t.h3,{id:"1-absolute-difference",children:"1. Absolute Difference"}),"\n",(0,s.jsx)(t.p,{children:"Absolute difference in group mean/median/number of times a certain event happens."}),"\n",(0,s.jsxs)(t.ul,{children:["\n",(0,s.jsxs)(t.li,{children:["\u2705 Used for measuring how different two ",(0,s.jsx)(t.strong,{children:"numerical distributions"})," are, and when the alternative hypothesis is ",(0,s.jsx)(t.strong,{children:(0,s.jsx)(t.em,{children:"not equal to"})}),'. For example, "the coin is biased" or "the probability of tossing a head is 0.5".']}),"\n"]}),"\n",(0,s.jsx)(t.h3,{id:"2-difference",children:"2. Difference"}),"\n",(0,s.jsx)(t.p,{children:"Difference in group mean/median/number of times a certain event happens"}),"\n",(0,s.jsxs)(t.ul,{children:["\n",(0,s.jsxs)(t.li,{children:["\u2705 Used for measuring how different two ",(0,s.jsx)(t.strong,{children:"numerical distributions"})," are, and the alternative hypothesis is ",(0,s.jsx)(t.strong,{children:(0,s.jsx)(t.em,{children:"less than"})})," or ",(0,s.jsx)(t.strong,{children:(0,s.jsx)(t.em,{children:"greater than"})}),'. For example, "the coin is biased towards heads" or "the probability of tossing a head is greater then 0.5".']}),"\n"]}),"\n",(0,s.jsx)(t.h3,{id:"3-total-variation-distance-tvd",children:"3. Total Variation Distance (TVD)"}),"\n",(0,s.jsxs)(t.p,{children:["A test statistic that quantifies how different ",(0,s.jsx)(t.strong,{children:"two categorical distributions"})," are by calculating the sum of the absolute differences of their proportions, all divided by 2."]}),"\n",(0,s.jsxs)(t.ul,{children:["\n",(0,s.jsx)(t.li,{children:"The TVD is not used for permutation tests"}),"\n",(0,s.jsxs)(t.li,{children:['\u2705 Used for assessing whether an "observed sample" was drawn randomly from a known ',(0,s.jsx)(t.strong,{children:"categorical distribution"}),":"]}),"\n"]}),"\n",(0,s.jsxs)(t.admonition,{type:"note",children:[(0,s.jsxs)(t.p,{children:[(0,s.jsx)(t.strong,{children:"3 Ways of Computing TVD"})," \ud83e\uddee"]}),(0,s.jsxs)(t.ol,{children:["\n",(0,s.jsx)(t.li,{children:"Follow the definition (calculating the sum of the absolute differences of the two distributions' proportions, all divided by 2)"}),"\n",(0,s.jsx)(t.li,{}),"\n",(0,s.jsx)(t.li,{}),"\n"]})]})]})}function h(e={}){const{wrapper:t}={...(0,i.R)(),...e.components};return t?(0,s.jsx)(t,{...e,children:(0,s.jsx)(c,{...e})}):c(e)}},8597:(e,t,n)=>{n.d(t,{A:()=>i});n(6540);var s=n(4848);const i=e=>{let{data:t}=e,n=[],i=[],r="",o=[];if(t){const e=JSON.parse(t);n=e.columns||[],i=e.data||[],r=e.indexName||"Index",o=e.index||[]}return(0,s.jsx)("div",{className:"dataframe-container",children:(0,s.jsxs)("table",{className:"dataframe-table",children:[(0,s.jsx)("thead",{children:(0,s.jsxs)("tr",{children:[(0,s.jsx)("th",{children:r}),n.map(((e,t)=>(0,s.jsx)("th",{children:e},t)))]})}),(0,s.jsx)("tbody",{children:i.map(((e,t)=>(0,s.jsxs)("tr",{children:[(0,s.jsx)("td",{className:"index-value",children:o[t]}),e.map(((e,t)=>{return(0,s.jsx)("td",{children:(n=e,"boolean"==typeof n?n.toString().charAt(0).toUpperCase()+n.toString().slice(1):n)},t);var n}))]},t)))})]})})}},5158:(e,t,n)=>{n.d(t,{A:()=>r});var s=n(6540),i=n(4848);const r=function(e){let{src:t,sourceLink:n,width:r="100%",height:o="100%",paddingBottom:a="56.25%"}=e;const[l,d]=(0,s.useState)(0);return(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)("div",{style:{position:"relative",height:"0",paddingBottom:a,overflow:"hidden",maxWidth:"100%"},children:(0,i.jsx)("iframe",{src:t,style:{position:"absolute",top:0,left:0,width:r,height:o,frameBorder:"0",allowFullScreen:!0}},l)}),(0,i.jsx)("div",{style:{display:"flex",justifyContent:"center",margin:"20px 0"},children:(0,i.jsx)("a",{href:n,target:"_blank",rel:"noopener noreferrer",children:"(Source)"})}),(0,i.jsx)("div",{style:{display:"flex",justifyContent:"center",margin:"10px 0"},children:(0,i.jsx)("button",{onClick:()=>{d((e=>e+1))},style:{backgroundColor:"#4CAF50",color:"white",padding:"10px 20px",border:"none",borderRadius:"5px",cursor:"pointer",outline:"none",fontSize:"16px",fontWeight:"bold",boxShadow:"0 4px 8px rgba(0,0,0,0.1)",transition:"background-color 0.3s"},onMouseOver:e=>e.currentTarget.style.backgroundColor="#45a049",onMouseOut:e=>e.currentTarget.style.backgroundColor="#4CAF50",children:"Restart Diagram"})})]})}},8453:(e,t,n)=>{n.d(t,{R:()=>o,x:()=>a});var s=n(6540);const i={},r=s.createContext(i);function o(e){const t=s.useContext(r);return s.useMemo((function(){return"function"==typeof e?e(t):{...t,...e}}),[t,e])}function a(e){let t;return t=e.disableParentContext?"function"==typeof e.components?e.components(i):e.components||i:o(e.components),s.createElement(r.Provider,{value:t},e.children)}}}]); \ No newline at end of file +"use strict";(self.webpackChunkbpd_reference=self.webpackChunkbpd_reference||[]).push([[6142],{3071:(e,t,n)=>{n.r(t),n.d(t,{assets:()=>l,contentTitle:()=>o,default:()=>h,frontMatter:()=>r,metadata:()=>a,toc:()=>d});var s=n(4848),i=n(8453);n(8597),n(5158);const r={sidebar_position:4,sidebar_label:"Observed & Test Statistic",title:"Observed & Test Statistic"},o=void 0,a={id:"statistical-inference/obs_and_test_stats",title:"Observed & Test Statistic",description:"Concept",source:"@site/docs/statistical-inference/obs_and_test_stats.md",sourceDirName:"statistical-inference",slug:"/statistical-inference/obs_and_test_stats",permalink:"/bpd-reference/docs/statistical-inference/obs_and_test_stats",draft:!1,unlisted:!1,editUrl:"https://github.com/dsc-courses/bpd-reference/tree/main/docs/statistical-inference/obs_and_test_stats.md",tags:[],version:"current",sidebarPosition:4,frontMatter:{sidebar_position:4,sidebar_label:"Observed & Test Statistic",title:"Observed & Test Statistic"},sidebar:"statsSidebar",previous:{title:"Null & Alternative Hypothesis",permalink:"/bpd-reference/docs/statistical-inference/null_and_alt"},next:{title:"P-value",permalink:"/bpd-reference/docs/statistical-inference/p_value"}},l={},d=[{value:"Concept",id:"concept",level:2},{value:"Common Test Statistic \ud83c\udf1f",id:"common-test-statistic-",level:2},{value:"1. Absolute Difference",id:"1-absolute-difference",level:3},{value:"2. Difference",id:"2-difference",level:3},{value:"3. Total Variation Distance (TVD)",id:"3-total-variation-distance-tvd",level:3}];function c(e){const t={admonition:"admonition",em:"em",h2:"h2",h3:"h3",li:"li",ol:"ol",p:"p",strong:"strong",ul:"ul",...(0,i.R)(),...e.components};return(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(t.h2,{id:"concept",children:"Concept"}),"\n",(0,s.jsxs)(t.admonition,{title:"Terminology",type:"info",children:[(0,s.jsxs)(t.p,{children:[(0,s.jsx)(t.strong,{children:"Experiment"}),": A process whose outcome is random."]}),(0,s.jsxs)(t.ul,{children:["\n",(0,s.jsx)(t.li,{children:"Example: flipping 100 coins."}),"\n"]}),(0,s.jsxs)(t.p,{children:[(0,s.jsx)(t.strong,{children:"Observed Statistic"}),": A statistic computed from the observed data."]}),(0,s.jsxs)(t.ul,{children:["\n",(0,s.jsx)(t.li,{children:"Example: The number of heads observed."}),"\n"]}),(0,s.jsxs)(t.p,{children:[(0,s.jsx)(t.strong,{children:"Test Statistic"}),": A statistic computed from a sample generated under the assumption that the null hypothesis is true."]}),(0,s.jsxs)(t.ul,{children:["\n",(0,s.jsx)(t.li,{children:"Think of the test statistic a number you write down each time you perform an experiment."}),"\n",(0,s.jsx)(t.li,{children:"The test statistic should be such that high observed values lean towards one hypothesis and low observed values lean towards the other."}),"\n"]})]}),"\n",(0,s.jsx)(t.h2,{id:"common-test-statistic-",children:"Common Test Statistic \ud83c\udf1f"}),"\n",(0,s.jsx)(t.h3,{id:"1-absolute-difference",children:"1. Absolute Difference"}),"\n",(0,s.jsx)(t.p,{children:"Absolute difference in group mean/median/number of times a certain event happens."}),"\n",(0,s.jsxs)(t.ul,{children:["\n",(0,s.jsxs)(t.li,{children:["\u2705 Used for measuring how different two ",(0,s.jsx)(t.strong,{children:"numerical distributions"})," are, and when the alternative hypothesis is ",(0,s.jsx)(t.strong,{children:(0,s.jsx)(t.em,{children:"not equal to"})}),'. For example, "the coin is biased" or "the probability of tossing a head is 0.5".']}),"\n"]}),"\n",(0,s.jsx)(t.h3,{id:"2-difference",children:"2. Difference"}),"\n",(0,s.jsx)(t.p,{children:"Difference in group mean/median/number of times a certain event happens"}),"\n",(0,s.jsxs)(t.ul,{children:["\n",(0,s.jsxs)(t.li,{children:["\u2705 Used for measuring how different two ",(0,s.jsx)(t.strong,{children:"numerical distributions"})," are, and the alternative hypothesis is ",(0,s.jsx)(t.strong,{children:(0,s.jsx)(t.em,{children:"less than"})})," or ",(0,s.jsx)(t.strong,{children:(0,s.jsx)(t.em,{children:"greater than"})}),'. For example, "the coin is biased towards heads" or "the probability of tossing a head is greater then 0.5".']}),"\n"]}),"\n",(0,s.jsx)(t.h3,{id:"3-total-variation-distance-tvd",children:"3. Total Variation Distance (TVD)"}),"\n",(0,s.jsxs)(t.p,{children:["A test statistic that quantifies how different ",(0,s.jsx)(t.strong,{children:"two categorical distributions"})," are by calculating the sum of the absolute differences of their proportions, all divided by 2."]}),"\n",(0,s.jsxs)(t.ul,{children:["\n",(0,s.jsx)(t.li,{children:"\u2716\ufe0f The TVD is not used for permutation tests"}),"\n",(0,s.jsxs)(t.li,{children:['\u2705 Used for assessing whether an "observed sample" was drawn randomly from a known ',(0,s.jsx)(t.strong,{children:"categorical distribution"}),":"]}),"\n"]}),"\n",(0,s.jsxs)(t.admonition,{type:"note",children:[(0,s.jsxs)(t.p,{children:[(0,s.jsx)(t.strong,{children:"3 Ways of Computing TVD"})," \ud83e\uddee"]}),(0,s.jsxs)(t.ol,{children:["\n",(0,s.jsx)(t.li,{children:"Follow the definition (calculating the sum of the absolute differences of the two distributions' proportions, all divided by 2)"}),"\n",(0,s.jsx)(t.li,{}),"\n",(0,s.jsx)(t.li,{}),"\n"]})]})]})}function h(e={}){const{wrapper:t}={...(0,i.R)(),...e.components};return t?(0,s.jsx)(t,{...e,children:(0,s.jsx)(c,{...e})}):c(e)}},8597:(e,t,n)=>{n.d(t,{A:()=>i});n(6540);var s=n(4848);const i=e=>{let{data:t}=e,n=[],i=[],r="",o=[];if(t){const e=JSON.parse(t);n=e.columns||[],i=e.data||[],r=e.indexName||"Index",o=e.index||[]}return(0,s.jsx)("div",{className:"dataframe-container",children:(0,s.jsxs)("table",{className:"dataframe-table",children:[(0,s.jsx)("thead",{children:(0,s.jsxs)("tr",{children:[(0,s.jsx)("th",{children:r}),n.map(((e,t)=>(0,s.jsx)("th",{children:e},t)))]})}),(0,s.jsx)("tbody",{children:i.map(((e,t)=>(0,s.jsxs)("tr",{children:[(0,s.jsx)("td",{className:"index-value",children:o[t]}),e.map(((e,t)=>{return(0,s.jsx)("td",{children:(n=e,"boolean"==typeof n?n.toString().charAt(0).toUpperCase()+n.toString().slice(1):n)},t);var n}))]},t)))})]})})}},5158:(e,t,n)=>{n.d(t,{A:()=>r});var s=n(6540),i=n(4848);const r=function(e){let{src:t,sourceLink:n,width:r="100%",height:o="100%",paddingBottom:a="56.25%"}=e;const[l,d]=(0,s.useState)(0);return(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)("div",{style:{position:"relative",height:"0",paddingBottom:a,overflow:"hidden",maxWidth:"100%"},children:(0,i.jsx)("iframe",{src:t,style:{position:"absolute",top:0,left:0,width:r,height:o,frameBorder:"0",allowFullScreen:!0}},l)}),(0,i.jsx)("div",{style:{display:"flex",justifyContent:"center",margin:"20px 0"},children:(0,i.jsx)("a",{href:n,target:"_blank",rel:"noopener noreferrer",children:"(Source)"})}),(0,i.jsx)("div",{style:{display:"flex",justifyContent:"center",margin:"10px 0"},children:(0,i.jsx)("button",{onClick:()=>{d((e=>e+1))},style:{backgroundColor:"#4CAF50",color:"white",padding:"10px 20px",border:"none",borderRadius:"5px",cursor:"pointer",outline:"none",fontSize:"16px",fontWeight:"bold",boxShadow:"0 4px 8px rgba(0,0,0,0.1)",transition:"background-color 0.3s"},onMouseOver:e=>e.currentTarget.style.backgroundColor="#45a049",onMouseOut:e=>e.currentTarget.style.backgroundColor="#4CAF50",children:"Restart Diagram"})})]})}},8453:(e,t,n)=>{n.d(t,{R:()=>o,x:()=>a});var s=n(6540);const i={},r=s.createContext(i);function o(e){const t=s.useContext(r);return s.useMemo((function(){return"function"==typeof e?e(t):{...t,...e}}),[t,e])}function a(e){let t;return t=e.disableParentContext?"function"==typeof e.components?e.components(i):e.components||i:o(e.components),s.createElement(r.Provider,{value:t},e.children)}}}]); \ No newline at end of file diff --git a/assets/js/9f1843d8.3bede0c7.js b/assets/js/9f1843d8.3bede0c7.js new file mode 100644 index 00000000..688bb435 --- /dev/null +++ b/assets/js/9f1843d8.3bede0c7.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkbpd_reference=self.webpackChunkbpd_reference||[]).push([[9894],{6171:(e,t,n)=>{n.r(t),n.d(t,{assets:()=>d,contentTitle:()=>l,default:()=>p,frontMatter:()=>o,metadata:()=>c,toc:()=>h});var s=n(4848),i=n(8453),a=n(8597),r=n(5158);const o={sidebar_position:7,sidebar_label:"Permutation Test",title:"Permutation Test",tags:["querying","functions","for-loop","histogram"]},l=void 0,c={id:"statistical-inference/permutation_test",title:"Permutation Test",description:"Concept",source:"@site/docs/statistical-inference/permutation_test.md",sourceDirName:"statistical-inference",slug:"/statistical-inference/permutation_test",permalink:"/bpd-reference/docs/statistical-inference/permutation_test",draft:!1,unlisted:!1,editUrl:"https://github.com/dsc-courses/bpd-reference/tree/main/docs/statistical-inference/permutation_test.md",tags:[{label:"querying",permalink:"/bpd-reference/docs/tags/querying"},{label:"functions",permalink:"/bpd-reference/docs/tags/functions"},{label:"for-loop",permalink:"/bpd-reference/docs/tags/for-loop"},{label:"histogram",permalink:"/bpd-reference/docs/tags/histogram"}],version:"current",sidebarPosition:7,frontMatter:{sidebar_position:7,sidebar_label:"Permutation Test",title:"Permutation Test",tags:["querying","functions","for-loop","histogram"]},sidebar:"statsSidebar",previous:{title:"Hypothesis Test",permalink:"/bpd-reference/docs/statistical-inference/hypothesis_test"},next:{title:"The Standard Normal Distribution",permalink:"/bpd-reference/docs/statistical-inference/standard_normal_distribution"}},d={},h=[{value:"Concept",id:"concept",level:2},{value:"Code Example",id:"code-example",level:2},{value:"1. State the question/hypothesis",id:"1-state-the-questionhypothesis",level:3},{value:"2. Query the DataFrame",id:"2-query-the-dataframe",level:3},{value:"3. Create a function to calculate test statistic",id:"3-create-a-function-to-calculate-test-statistic",level:3},{value:"4. Simulate the permutation test",id:"4-simulate-the-permutation-test",level:3},{value:"5. Conclusion",id:"5-conclusion",level:3},{value:"6. Extra",id:"6-extra",level:3}];function u(e){const t={a:"a",admonition:"admonition",annotation:"annotation",code:"code",em:"em",h2:"h2",h3:"h3",hr:"hr",img:"img",li:"li",math:"math",mo:"mo",mrow:"mrow",ol:"ol",p:"p",pre:"pre",semantics:"semantics",span:"span",strong:"strong",ul:"ul",...(0,i.R)(),...e.components};return(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(t.h2,{id:"concept",children:"Concept"}),"\n",(0,s.jsx)(t.admonition,{title:"Key Idea",type:"tip",children:(0,s.jsx)(t.p,{children:"We use a permutation test to test whether two samples are drawn from the same population."})}),"\n",(0,s.jsxs)(t.admonition,{title:"Terminology",type:"info",children:[(0,s.jsxs)(t.p,{children:[(0,s.jsx)(t.strong,{children:"Permutation"}),": A permutation of a sequence is a rearrangement of the elements in that sequence."]}),(0,s.jsxs)(t.ul,{children:["\n",(0,s.jsx)(t.li,{children:"Example: 'BAC' and 'CAB' are both permutations of the string 'ABC'."}),"\n",(0,s.jsx)(t.li,{children:"We create permutations by shuffling."}),"\n"]}),(0,s.jsxs)(t.p,{children:[(0,s.jsx)(t.strong,{children:"Permutation tests:"})," A permutation test is a type of A/B test (and a type of hypothesis test). It tests whether two samples come from the same population distribution. To conduct a permutation test:"]}),(0,s.jsxs)(t.ol,{children:["\n",(0,s.jsx)(t.li,{children:"Shuffle the group labels (i.e. the Trues and Falses) to generate two new samples under the null."}),"\n",(0,s.jsx)(t.li,{children:"Compute the test statistic (i.e. the difference in group means)."}),"\n",(0,s.jsx)(t.li,{children:"Repeat steps 1 and 2 to generate an empirical distribution of the test statistics (i.e. the difference in group means)."}),"\n",(0,s.jsx)(t.li,{children:"See where the observed statistic lies in the empirical distribution. If, in our simulations, we rarely saw a difference in group means as extreme as the observed difference in group means, we have evidence to reject the null."}),"\n"]})]}),"\n",(0,s.jsx)(t.admonition,{type:"note",children:(0,s.jsx)(t.p,{children:"While shuffling, the size of the two new samples should be the same as the observed samples."})}),"\n",(0,s.jsxs)(t.p,{children:["The diagram below provides an overview of conducting a permutation test, although it references a different dataset. ",(0,s.jsx)(t.a,{href:"https://www.jwilber.me/permutationtest/",children:"Here"})," is another useful visualization. For additional helpful visual guides, please visit the ",(0,s.jsx)(t.a,{href:"https://dsc10.com/diagrams/",children:"Diagrams"})," site."]}),"\n",(0,s.jsx)(r.A,{src:"https://docs.google.com/presentation/d/e/2PACX-1vSovXDonR6EmjrT45h4pY1mwmcKFMWVSdgpbKHC5HNTm9sbG7dojvvCDEQCjuk2dk1oA4gmwMogr8ZL/embed?start=true&loop=false&delayms=3000&rm=minimal",sourceLink:"https://docs.google.com/presentation/d/1TTWoQ7FU4tzBGc7EskF6WYccIn1BWQbTSizAiFc2p2o/edit?usp=sharing"}),"\n",(0,s.jsx)(t.hr,{}),"\n",(0,s.jsx)(t.h2,{id:"code-example",children:"Code Example"}),"\n",(0,s.jsx)(t.h3,{id:"1-state-the-questionhypothesis",children:"1. State the question/hypothesis"}),"\n",(0,s.jsxs)(t.admonition,{title:"Hypotheses",type:"info",children:[(0,s.jsx)(t.p,{children:"We will test the following pair of hypotheses at the standard p = 0.05 significance level:"}),(0,s.jsxs)(t.ul,{children:["\n",(0,s.jsxs)(t.li,{children:[(0,s.jsx)(t.strong,{children:"Null Hypothesis:"})," In the population, weights of dogs and cats have the ",(0,s.jsx)(t.strong,{children:"same"})," distribution, and the observed differences in our samples are due to random chance."]}),"\n",(0,s.jsxs)(t.li,{children:[(0,s.jsx)(t.strong,{children:"Alternative Hypothesis:"})," In the population, dogs and cats have ",(0,s.jsx)(t.strong,{children:"different"})," weights, on average. The observed differences in our samples cannot be explained by random chance alone."]}),"\n"]})]}),"\n",(0,s.jsxs)(t.p,{children:['Since the alternative hypothesis is of the form "A and B are different," the ',(0,s.jsx)(t.strong,{children:"test statistic"})," should measure distance and use an absolute value."]}),"\n",(0,s.jsxs)(t.p,{children:[(0,s.jsxs)(t.span,{className:"katex",children:[(0,s.jsx)(t.span,{className:"katex-mathml",children:(0,s.jsx)(t.math,{xmlns:"http://www.w3.org/1998/Math/MathML",children:(0,s.jsxs)(t.semantics,{children:[(0,s.jsx)(t.mrow,{children:(0,s.jsx)(t.mo,{children:"\u2234"})}),(0,s.jsx)(t.annotation,{encoding:"application/x-tex",children:"\\therefore"})]})})}),(0,s.jsx)(t.span,{className:"katex-html","aria-hidden":"true",children:(0,s.jsxs)(t.span,{className:"base",children:[(0,s.jsx)(t.span,{className:"strut",style:{height:"0.6922em"}}),(0,s.jsx)(t.span,{className:"mrel amsrm",children:"\u2234"})]})})]})," We use ",(0,s.jsx)(t.strong,{children:"absolute difference in group means"})," as the test statistic."]}),"\n",(0,s.jsx)(t.hr,{}),"\n",(0,s.jsx)(t.h3,{id:"2-query-the-dataframe",children:"2. Query the DataFrame"}),"\n",(0,s.jsx)(t.p,{children:"Since we want to compare the distributions of only cats and dogs, we need to make sure to only include the relevant pieces of data (e.g., cats and dogs weights)."}),"\n",(0,s.jsx)(t.pre,{children:(0,s.jsx)(t.code,{className:"language-python",children:"# Create a boolean Series that references which rows fulfill either condition.\nquerying_condition = (full_pets.get('Species') == 'dog') | (full_pets.get('Species') == 'cat')\n# Query.\ncats_dogs = full_pets[querying_condition]\n# Display the first 5 rows only.\ncats_dogs.take(np.arange(5)) \n"})}),"\n",(0,s.jsx)(a.A,{data:'{"columns":["ID","Species","Color","Weight","Age","Is_Cat","Owner_Comment"],"index":[0,1,2,3,4],"data":[["dog_001","dog","black",40.0,5.0,false," There are no bad dogs, only bad owners."],["cat_001","cat","golden",1.5,0.2,true,"My best birthday present ever!!!"],["cat_002","cat","black",15.0,9.0,true,"****All you need is love and a cat.****"],["dog_002","dog","white",80.0,2.0,false,"Love is a wet nose and a wagging tail."],["dog_003","dog","black",25.0,0.5,false,"Be the person your dog thinks you are."]]}'}),"\n",(0,s.jsx)(t.hr,{}),"\n",(0,s.jsx)(t.h3,{id:"3-create-a-function-to-calculate-test-statistic",children:"3. Create a function to calculate test statistic"}),"\n",(0,s.jsx)(t.p,{children:"Since our hypotheses depend on the test statistic, create a function to be able to calculate it during every trial of our permutation test."}),"\n",(0,s.jsx)(t.pre,{children:(0,s.jsx)(t.code,{className:"language-python",children:"def difference_in_means(cats_dogs):\n \"\"\"\n Calculate the absolute difference in the mean weight of dogs and cats.\n ---\n Input:\n cats_dogs: a DataFrame containing the columns 'Species' and 'Weight'.\n ---\n Output:\n The absolute difference in the mean weight of dogs and cats.\n \"\"\"\n means = cats_dogs.groupby('Species').mean()\n return np.abs((means.get('Weight').loc['dog'] - means.get('Weight').loc['cat']))\n"})}),"\n",(0,s.jsx)(t.p,{children:(0,s.jsx)(t.em,{children:"Note: Although we can simply do this in the for-loop shown in the next step, we can practice good coding habits by separating our code into readable bits!"})}),"\n",(0,s.jsx)(t.hr,{}),"\n",(0,s.jsx)(t.h3,{id:"4-simulate-the-permutation-test",children:"4. Simulate the permutation test"}),"\n",(0,s.jsx)(t.pre,{children:(0,s.jsx)(t.code,{className:"language-python",children:"n = 500 # Number of simulations.\nstatistics = np.array([]) # Array to keep track of the difference in means for each iteration.\nfor i in np.arange(n): # Run the simulation `n` number of times\n # 1. Shuffle the species.\n shuffled = cats_dogs.assign(Species=np.random.permutation(cats_dogs.get('Species')))\n\n # 2. Compute the test statistic.\n statistic = difference_in_means(shuffled)\n\n # 3. Save the result.\n statistics = np.append(statistics, statistic)\n"})}),"\n",(0,s.jsxs)(t.p,{children:["This code will run the permutation test 500 times, but a different reasonable number can be used instead. It is ",(0,s.jsx)(t.strong,{children:"crucial"})," to keep track of the difference in means each time our for-loop runs so that the number of simulated values can be displayed."]}),"\n",(0,s.jsx)(t.hr,{}),"\n",(0,s.jsx)(t.h3,{id:"5-conclusion",children:"5. Conclusion"}),"\n",(0,s.jsx)(t.pre,{children:(0,s.jsx)(t.code,{className:"language-python",children:'observed = difference_in_means(cats_dogs)\np_value = np.count_nonzero(statistics >= observed) / n\n\nprint("The observed value of the test statistic is:", observed)\nprint("The p-value is:", p_value)\n'})}),"\n",(0,s.jsxs)(t.p,{children:[(0,s.jsx)(t.strong,{children:"The observed value of the test statistic is: 30.361111111111107"})," ",(0,s.jsx)("br",{}),"\n",(0,s.jsx)(t.strong,{children:"The p-value is: 0.004"})]}),"\n",(0,s.jsx)(t.p,{children:"Using a significance level of 0.05:"}),"\n",(0,s.jsx)(t.admonition,{title:"Conclusion",type:"info",children:(0,s.jsxs)(t.ul,{children:["\n",(0,s.jsx)(t.li,{children:"Under the null hypothesis, we rarely see a difference greater than the observed value."}),"\n",(0,s.jsxs)(t.li,{children:["Therefore, we ",(0,s.jsx)(t.strong,{children:"reject"})," the null hypothesis: the evidence implies that the two groups do not come from the same distribution."]}),"\n",(0,s.jsx)(t.li,{children:"Still, we cannot conclude that species causes a different weight because there may be other confounding variables."}),"\n"]})}),"\n",(0,s.jsx)(t.hr,{}),"\n",(0,s.jsx)(t.h3,{id:"6-extra",children:"6. Extra"}),"\n",(0,s.jsx)(t.p,{children:"Let's see how our observed statistic compares to the overall simulated values!"}),"\n",(0,s.jsx)(t.pre,{children:(0,s.jsx)(t.code,{className:"language-python",children:"# Create the histogram.\nbpd.DataFrame().assign(statistics=statistics).plot(kind='hist', bins=20, density=True, ec='w')\n# Don't worry about this line - you won't need to know it for this course!\nplt.axvline(x=observed, c='black', linewidth=4, label='population difference in means')\n"})}),"\n",(0,s.jsx)(t.p,{children:(0,s.jsx)(t.img,{alt:"Distribution",src:n(8803).A+"",width:"576",height:"413"})}),"\n",(0,s.jsxs)(t.p,{children:["From this graph, we can tell that there is barely any data to the ",(0,s.jsx)(t.strong,{children:"right"})," of the black vertical line (our test statistic), meaning we have a very low p-value!"]})]})}function p(e={}){const{wrapper:t}={...(0,i.R)(),...e.components};return t?(0,s.jsx)(t,{...e,children:(0,s.jsx)(u,{...e})}):u(e)}},8597:(e,t,n)=>{n.d(t,{A:()=>i});n(6540);var s=n(4848);const i=e=>{let{data:t}=e,n=[],i=[],a="",r=[];if(t){const e=JSON.parse(t);n=e.columns||[],i=e.data||[],a=e.indexName||"Index",r=e.index||[]}return(0,s.jsx)("div",{className:"dataframe-container",children:(0,s.jsxs)("table",{className:"dataframe-table",children:[(0,s.jsx)("thead",{children:(0,s.jsxs)("tr",{children:[(0,s.jsx)("th",{children:a}),n.map(((e,t)=>(0,s.jsx)("th",{children:e},t)))]})}),(0,s.jsx)("tbody",{children:i.map(((e,t)=>(0,s.jsxs)("tr",{children:[(0,s.jsx)("td",{className:"index-value",children:r[t]}),e.map(((e,t)=>{return(0,s.jsx)("td",{children:(n=e,"boolean"==typeof n?n.toString().charAt(0).toUpperCase()+n.toString().slice(1):n)},t);var n}))]},t)))})]})})}},5158:(e,t,n)=>{n.d(t,{A:()=>a});var s=n(6540),i=n(4848);const a=function(e){let{src:t,sourceLink:n,width:a="100%",height:r="100%",paddingBottom:o="56.25%"}=e;const[l,c]=(0,s.useState)(0);return(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)("div",{style:{position:"relative",height:"0",paddingBottom:o,overflow:"hidden",maxWidth:"100%"},children:(0,i.jsx)("iframe",{src:t,style:{position:"absolute",top:0,left:0,width:a,height:r,frameBorder:"0",allowFullScreen:!0}},l)}),(0,i.jsx)("div",{style:{display:"flex",justifyContent:"center",margin:"20px 0"},children:(0,i.jsx)("a",{href:n,target:"_blank",rel:"noopener noreferrer",children:"(Source)"})}),(0,i.jsx)("div",{style:{display:"flex",justifyContent:"center",margin:"10px 0"},children:(0,i.jsx)("button",{onClick:()=>{c((e=>e+1))},style:{backgroundColor:"#4CAF50",color:"white",padding:"10px 20px",border:"none",borderRadius:"5px",cursor:"pointer",outline:"none",fontSize:"16px",fontWeight:"bold",boxShadow:"0 4px 8px rgba(0,0,0,0.1)",transition:"background-color 0.3s"},onMouseOver:e=>e.currentTarget.style.backgroundColor="#45a049",onMouseOut:e=>e.currentTarget.style.backgroundColor="#4CAF50",children:"Restart Diagram"})})]})}},8803:(e,t,n)=>{n.d(t,{A:()=>s});const s=n.p+"assets/images/permutation-test-fae4df12733e667b05989b96bf08d9a9.png"},8453:(e,t,n)=>{n.d(t,{R:()=>r,x:()=>o});var s=n(6540);const i={},a=s.createContext(i);function r(e){const t=s.useContext(a);return s.useMemo((function(){return"function"==typeof e?e(t):{...t,...e}}),[t,e])}function o(e){let t;return t=e.disableParentContext?"function"==typeof e.components?e.components(i):e.components||i:r(e.components),s.createElement(a.Provider,{value:t},e.children)}}}]); \ No newline at end of file diff --git a/assets/js/9f1843d8.8fe7c9be.js b/assets/js/9f1843d8.8fe7c9be.js deleted file mode 100644 index 2ea17817..00000000 --- a/assets/js/9f1843d8.8fe7c9be.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunkbpd_reference=self.webpackChunkbpd_reference||[]).push([[9894],{6171:(e,t,n)=>{n.r(t),n.d(t,{assets:()=>d,contentTitle:()=>l,default:()=>p,frontMatter:()=>o,metadata:()=>c,toc:()=>h});var s=n(4848),i=n(8453),a=n(8597),r=n(5158);const o={sidebar_position:7,sidebar_label:"Permutation Test",title:"Permutation Test",tags:["querying","functions","for-loop","histogram"]},l=void 0,c={id:"statistical-inference/permutation_test",title:"Permutation Test",description:"Concept",source:"@site/docs/statistical-inference/permutation_test.md",sourceDirName:"statistical-inference",slug:"/statistical-inference/permutation_test",permalink:"/bpd-reference/docs/statistical-inference/permutation_test",draft:!1,unlisted:!1,editUrl:"https://github.com/dsc-courses/bpd-reference/tree/main/docs/statistical-inference/permutation_test.md",tags:[{label:"querying",permalink:"/bpd-reference/docs/tags/querying"},{label:"functions",permalink:"/bpd-reference/docs/tags/functions"},{label:"for-loop",permalink:"/bpd-reference/docs/tags/for-loop"},{label:"histogram",permalink:"/bpd-reference/docs/tags/histogram"}],version:"current",sidebarPosition:7,frontMatter:{sidebar_position:7,sidebar_label:"Permutation Test",title:"Permutation Test",tags:["querying","functions","for-loop","histogram"]},sidebar:"statsSidebar",previous:{title:"Hypothesis Test",permalink:"/bpd-reference/docs/statistical-inference/hypothesis_test"},next:{title:"The Standard Normal Distribution",permalink:"/bpd-reference/docs/statistical-inference/standard_normal_distribution"}},d={},h=[{value:"Concept",id:"concept",level:2},{value:"Code Example",id:"code-example",level:2},{value:"1. State the question/hypothesis",id:"1-state-the-questionhypothesis",level:3},{value:"2. Query the DataFrame",id:"2-query-the-dataframe",level:3},{value:"3. Create a function to calculate test statistic",id:"3-create-a-function-to-calculate-test-statistic",level:3},{value:"4. Simulate the permutation test",id:"4-simulate-the-permutation-test",level:3},{value:"5. Conclusion",id:"5-conclusion",level:3},{value:"6. Extra",id:"6-extra",level:3}];function u(e){const t={a:"a",admonition:"admonition",annotation:"annotation",code:"code",em:"em",h2:"h2",h3:"h3",hr:"hr",img:"img",li:"li",math:"math",mo:"mo",mrow:"mrow",ol:"ol",p:"p",pre:"pre",semantics:"semantics",span:"span",strong:"strong",ul:"ul",...(0,i.R)(),...e.components};return(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(t.h2,{id:"concept",children:"Concept"}),"\n",(0,s.jsx)(t.admonition,{title:"Key Idea",type:"tip",children:(0,s.jsx)(t.p,{children:"We use a permutation test to test whether two samples are drawn from the same population."})}),"\n",(0,s.jsxs)(t.admonition,{title:"Terminology",type:"info",children:[(0,s.jsxs)(t.p,{children:[(0,s.jsx)(t.strong,{children:"Permutation"}),": A permutation of a sequence is a rearrangement of the elements in that sequence."]}),(0,s.jsxs)(t.ul,{children:["\n",(0,s.jsx)(t.li,{children:"Example: 'BAC' and 'CAB' are both permutations of the string 'ABC'."}),"\n",(0,s.jsx)(t.li,{children:"We create permutations by shuffling."}),"\n"]}),(0,s.jsxs)(t.p,{children:[(0,s.jsx)(t.strong,{children:"Permutation tests:"})," A permutation test is a type of A/B test (and a type of hypothesis test). It tests whether two samples come from the same population distribution. To conduct a permutation test:"]}),(0,s.jsxs)(t.ol,{children:["\n",(0,s.jsx)(t.li,{children:"Shuffle the group labels (i.e. the Trues and Falses) to generate two new samples under the null."}),"\n",(0,s.jsx)(t.li,{children:"Compute the test statistic (i.e. the difference in group means)."}),"\n",(0,s.jsx)(t.li,{children:"Repeat steps 1 and 2 to generate an empirical distribution of the test statistics (i.e. the difference in group means)."}),"\n",(0,s.jsx)(t.li,{children:"See where the observed statistic lies in the empirical distribution. If, in our simulations, we rarely saw a difference in group means as extreme as the observed difference in group means, we have evidence to reject the null."}),"\n"]})]}),"\n",(0,s.jsx)(t.admonition,{type:"note",children:(0,s.jsx)(t.p,{children:"While shuffling, the size of the two new samples should be the same as the observed samples."})}),"\n",(0,s.jsxs)(t.p,{children:["The diagram below provides an overview of conducting a permutation test, although it references a different dataset. ",(0,s.jsx)(t.a,{href:"https://www.jwilber.me/permutationtest/",children:"Here"})," is another useful visualization. For additional helpful visual guides, please visit the ",(0,s.jsx)(t.a,{href:"https://dsc10.com/diagrams/",children:"Diagrams"})," site."]}),"\n",(0,s.jsx)(r.A,{src:"https://docs.google.com/presentation/d/e/2PACX-1vSovXDonR6EmjrT45h4pY1mwmcKFMWVSdgpbKHC5HNTm9sbG7dojvvCDEQCjuk2dk1oA4gmwMogr8ZL/embed?start=true&loop=false&delayms=3000&rm=minimal",sourceLink:"https://docs.google.com/presentation/d/1TTWoQ7FU4tzBGc7EskF6WYccIn1BWQbTSizAiFc2p2o/edit?usp=sharing"}),"\n",(0,s.jsx)(t.hr,{}),"\n",(0,s.jsx)(t.h2,{id:"code-example",children:"Code Example"}),"\n",(0,s.jsx)(t.h3,{id:"1-state-the-questionhypothesis",children:"1. State the question/hypothesis"}),"\n",(0,s.jsxs)(t.admonition,{title:"Hypotheses",type:"info",children:[(0,s.jsx)(t.p,{children:"Our pair of hypotheses is:"}),(0,s.jsxs)(t.ul,{children:["\n",(0,s.jsxs)(t.li,{children:[(0,s.jsx)(t.strong,{children:"Null Hypothesis:"})," In the population, weights of dogs and cats have the same distribution, and the observed differences in our samples are due to random chance."]}),"\n",(0,s.jsxs)(t.li,{children:[(0,s.jsx)(t.strong,{children:"Alternative Hypothesis:"})," In the population, dogs and cats have different weights, on average. The observed differences in our samples cannot be explained by random chance alone."]}),"\n"]})]}),"\n",(0,s.jsxs)(t.p,{children:['Since the alternative hypothesis is of the form "A and B are different," the ',(0,s.jsx)(t.strong,{children:"test statistic"})," should measure distance and use an absolute value."]}),"\n",(0,s.jsxs)(t.p,{children:[(0,s.jsxs)(t.span,{className:"katex",children:[(0,s.jsx)(t.span,{className:"katex-mathml",children:(0,s.jsx)(t.math,{xmlns:"http://www.w3.org/1998/Math/MathML",children:(0,s.jsxs)(t.semantics,{children:[(0,s.jsx)(t.mrow,{children:(0,s.jsx)(t.mo,{children:"\u2234"})}),(0,s.jsx)(t.annotation,{encoding:"application/x-tex",children:"\\therefore"})]})})}),(0,s.jsx)(t.span,{className:"katex-html","aria-hidden":"true",children:(0,s.jsxs)(t.span,{className:"base",children:[(0,s.jsx)(t.span,{className:"strut",style:{height:"0.6922em"}}),(0,s.jsx)(t.span,{className:"mrel amsrm",children:"\u2234"})]})})]})," Use ",(0,s.jsx)(t.strong,{children:"absolute difference in group means"})," as the test statistic."]}),"\n",(0,s.jsx)(t.hr,{}),"\n",(0,s.jsx)(t.h3,{id:"2-query-the-dataframe",children:"2. Query the DataFrame"}),"\n",(0,s.jsx)(t.p,{children:"Since we want to compare the distributions of only cats and dogs, we need to make sure to only include the relevant pieces of data (e.g., cats and dogs weights)."}),"\n",(0,s.jsx)(t.pre,{children:(0,s.jsx)(t.code,{className:"language-python",children:"# Create a boolean Series that references which rows fulfill either condition.\nquerying_condition = (full_pets.get('Species') == 'dog') | (full_pets.get('Species') == 'cat')\n# Query.\ncats_dogs = full_pets[querying_condition]\n# Display the first 5 rows only.\ncats_dogs.take(np.arange(5)) \n"})}),"\n",(0,s.jsx)(a.A,{data:'{"columns":["ID","Species","Color","Weight","Age","Is_Cat","Owner_Comment"],"index":[0,1,2,3,4],"data":[["dog_001","dog","black",40.0,5.0,false," There are no bad dogs, only bad owners."],["cat_001","cat","golden",1.5,0.2,true,"My best birthday present ever!!!"],["cat_002","cat","black",15.0,9.0,true,"****All you need is love and a cat.****"],["dog_002","dog","white",80.0,2.0,false,"Love is a wet nose and a wagging tail."],["dog_003","dog","black",25.0,0.5,false,"Be the person your dog thinks you are."]]}'}),"\n",(0,s.jsx)(t.hr,{}),"\n",(0,s.jsx)(t.h3,{id:"3-create-a-function-to-calculate-test-statistic",children:"3. Create a function to calculate test statistic"}),"\n",(0,s.jsx)(t.p,{children:"Since our hypotheses depend on the test statistic, create a function to be able to calculate it during every trial of our permutation test."}),"\n",(0,s.jsx)(t.pre,{children:(0,s.jsx)(t.code,{className:"language-python",children:"def difference_in_means(cats_dogs):\n \"\"\"\n Calculate the absolute difference in the mean weight of dogs and cats.\n ---\n Input:\n cats_dogs: a DataFrame containing the columns 'Species' and 'Weight'.\n ---\n Output:\n The absolute difference in the mean weight of dogs and cats.\n \"\"\"\n means = cats_dogs.groupby('Species').mean()\n return np.abs((means.get('Weight').loc['dog'] - means.get('Weight').loc['cat']))\n"})}),"\n",(0,s.jsx)(t.p,{children:(0,s.jsx)(t.em,{children:"Note: Although we can simply do this in the for-loop shown in the next step, we can practice good coding habits by separating our code into readable bits!"})}),"\n",(0,s.jsx)(t.hr,{}),"\n",(0,s.jsx)(t.h3,{id:"4-simulate-the-permutation-test",children:"4. Simulate the permutation test"}),"\n",(0,s.jsx)(t.pre,{children:(0,s.jsx)(t.code,{className:"language-python",children:"n = 500 # Number of simulations.\nstatistics = np.array([]) # Array to keep track of the difference in means for each iteration.\nfor i in np.arange(n): # Run the simulation `n` number of times\n # 1. Shuffle the species.\n shuffled = cats_dogs.assign(Species=np.random.permutation(cats_dogs.get('Species')))\n\n # 2. Compute the test statistic.\n statistic = difference_in_means(shuffled)\n\n # 3. Save the result.\n statistics = np.append(statistics, statistic)\n"})}),"\n",(0,s.jsxs)(t.p,{children:["This code will run the permutation test 500 times, but a different reasonable number can be used instead. It is ",(0,s.jsx)(t.strong,{children:"crucial"})," to keep track of the difference in means each time our for-loop runs so that the number of simulated values can be displayed."]}),"\n",(0,s.jsx)(t.hr,{}),"\n",(0,s.jsx)(t.h3,{id:"5-conclusion",children:"5. Conclusion"}),"\n",(0,s.jsx)(t.pre,{children:(0,s.jsx)(t.code,{className:"language-python",children:'observed = difference_in_means(cats_dogs)\np_value = np.count_nonzero(statistics >= observed) / n\n\nprint("The observed value of the test statistic is:", observed)\nprint("The p-value is:", p_value)\n'})}),"\n",(0,s.jsxs)(t.p,{children:[(0,s.jsx)(t.strong,{children:"The observed value of the test statistic is: 30.361111111111107"})," ",(0,s.jsx)("br",{}),"\n",(0,s.jsx)(t.strong,{children:"The p-value is: 0.004"})]}),"\n",(0,s.jsx)(t.p,{children:"Using a significance level of 0.05:"}),"\n",(0,s.jsx)(t.admonition,{title:"Conclusion",type:"info",children:(0,s.jsxs)(t.ul,{children:["\n",(0,s.jsx)(t.li,{children:"Under the null hypothesis, we rarely see a difference greater than the observed value."}),"\n",(0,s.jsxs)(t.li,{children:["Therefore, we ",(0,s.jsx)(t.strong,{children:"reject"})," the null hypothesis: the evidence implies that the two groups do not come from the same distribution."]}),"\n",(0,s.jsx)(t.li,{children:"Still, we cannot conclude that species causes a different weight because there may be other confounding variables."}),"\n"]})}),"\n",(0,s.jsx)(t.hr,{}),"\n",(0,s.jsx)(t.h3,{id:"6-extra",children:"6. Extra"}),"\n",(0,s.jsx)(t.p,{children:"Let's see how our observed statistic compares to the overall simulated values!"}),"\n",(0,s.jsx)(t.pre,{children:(0,s.jsx)(t.code,{className:"language-python",children:"# Create the histogram.\nbpd.DataFrame().assign(statistics=statistics).plot(kind='hist', bins=20, density=True, ec='w')\n# Don't worry about this line - you won't need to know it for this course!\nplt.axvline(x=observed, c='black', linewidth=4, label='population difference in means')\n"})}),"\n",(0,s.jsx)(t.p,{children:(0,s.jsx)(t.img,{alt:"Distribution",src:n(8803).A+"",width:"576",height:"413"})}),"\n",(0,s.jsxs)(t.p,{children:["From this graph, we can tell that there is barely any data to the ",(0,s.jsx)(t.strong,{children:"right"})," of the black vertical line (our test statistic), meaning we have a very low p-value!"]})]})}function p(e={}){const{wrapper:t}={...(0,i.R)(),...e.components};return t?(0,s.jsx)(t,{...e,children:(0,s.jsx)(u,{...e})}):u(e)}},8597:(e,t,n)=>{n.d(t,{A:()=>i});n(6540);var s=n(4848);const i=e=>{let{data:t}=e,n=[],i=[],a="",r=[];if(t){const e=JSON.parse(t);n=e.columns||[],i=e.data||[],a=e.indexName||"Index",r=e.index||[]}return(0,s.jsx)("div",{className:"dataframe-container",children:(0,s.jsxs)("table",{className:"dataframe-table",children:[(0,s.jsx)("thead",{children:(0,s.jsxs)("tr",{children:[(0,s.jsx)("th",{children:a}),n.map(((e,t)=>(0,s.jsx)("th",{children:e},t)))]})}),(0,s.jsx)("tbody",{children:i.map(((e,t)=>(0,s.jsxs)("tr",{children:[(0,s.jsx)("td",{className:"index-value",children:r[t]}),e.map(((e,t)=>{return(0,s.jsx)("td",{children:(n=e,"boolean"==typeof n?n.toString().charAt(0).toUpperCase()+n.toString().slice(1):n)},t);var n}))]},t)))})]})})}},5158:(e,t,n)=>{n.d(t,{A:()=>a});var s=n(6540),i=n(4848);const a=function(e){let{src:t,sourceLink:n,width:a="100%",height:r="100%",paddingBottom:o="56.25%"}=e;const[l,c]=(0,s.useState)(0);return(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)("div",{style:{position:"relative",height:"0",paddingBottom:o,overflow:"hidden",maxWidth:"100%"},children:(0,i.jsx)("iframe",{src:t,style:{position:"absolute",top:0,left:0,width:a,height:r,frameBorder:"0",allowFullScreen:!0}},l)}),(0,i.jsx)("div",{style:{display:"flex",justifyContent:"center",margin:"20px 0"},children:(0,i.jsx)("a",{href:n,target:"_blank",rel:"noopener noreferrer",children:"(Source)"})}),(0,i.jsx)("div",{style:{display:"flex",justifyContent:"center",margin:"10px 0"},children:(0,i.jsx)("button",{onClick:()=>{c((e=>e+1))},style:{backgroundColor:"#4CAF50",color:"white",padding:"10px 20px",border:"none",borderRadius:"5px",cursor:"pointer",outline:"none",fontSize:"16px",fontWeight:"bold",boxShadow:"0 4px 8px rgba(0,0,0,0.1)",transition:"background-color 0.3s"},onMouseOver:e=>e.currentTarget.style.backgroundColor="#45a049",onMouseOut:e=>e.currentTarget.style.backgroundColor="#4CAF50",children:"Restart Diagram"})})]})}},8803:(e,t,n)=>{n.d(t,{A:()=>s});const s=n.p+"assets/images/permutation-test-fae4df12733e667b05989b96bf08d9a9.png"},8453:(e,t,n)=>{n.d(t,{R:()=>r,x:()=>o});var s=n(6540);const i={},a=s.createContext(i);function r(e){const t=s.useContext(a);return s.useMemo((function(){return"function"==typeof e?e(t):{...t,...e}}),[t,e])}function o(e){let t;return t=e.disableParentContext?"function"==typeof e.components?e.components(i):e.components||i:r(e.components),s.createElement(a.Provider,{value:t},e.children)}}}]); \ No newline at end of file diff --git a/assets/js/f03ae67e.11dc796d.js b/assets/js/f03ae67e.11dc796d.js deleted file mode 100644 index 17a61d65..00000000 --- a/assets/js/f03ae67e.11dc796d.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunkbpd_reference=self.webpackChunkbpd_reference||[]).push([[972],{3007:(e,t,s)=>{s.r(t),s.d(t,{assets:()=>l,contentTitle:()=>r,default:()=>h,frontMatter:()=>o,metadata:()=>a,toc:()=>c});var n=s(4848),i=s(8453);s(8597),s(5158);const o={sidebar_position:6,sidebar_label:"Hypothesis Test",title:"Hypothesis Test",tags:["querying","functions","for-loop","histogram"]},r=void 0,a={id:"statistical-inference/hypothesis_test",title:"Hypothesis Test",description:"Concept",source:"@site/docs/statistical-inference/hypothesis_test.md",sourceDirName:"statistical-inference",slug:"/statistical-inference/hypothesis_test",permalink:"/bpd-reference/docs/statistical-inference/hypothesis_test",draft:!1,unlisted:!1,editUrl:"https://github.com/dsc-courses/bpd-reference/tree/main/docs/statistical-inference/hypothesis_test.md",tags:[{label:"querying",permalink:"/bpd-reference/docs/tags/querying"},{label:"functions",permalink:"/bpd-reference/docs/tags/functions"},{label:"for-loop",permalink:"/bpd-reference/docs/tags/for-loop"},{label:"histogram",permalink:"/bpd-reference/docs/tags/histogram"}],version:"current",sidebarPosition:6,frontMatter:{sidebar_position:6,sidebar_label:"Hypothesis Test",title:"Hypothesis Test",tags:["querying","functions","for-loop","histogram"]},sidebar:"statsSidebar",previous:{title:"P-value",permalink:"/bpd-reference/docs/statistical-inference/p_value"},next:{title:"Permutation Test",permalink:"/bpd-reference/docs/statistical-inference/permutation_test"}},l={},c=[{value:"Concept",id:"concept",level:2},{value:"Code Example",id:"code-example",level:2},{value:"1. State the question/hypothesis",id:"1-state-the-questionhypothesis",level:3},{value:"2. Query the DataFrame",id:"2-query-the-dataframe",level:3},{value:"3. Create a function to calculate test statistic",id:"3-create-a-function-to-calculate-test-statistic",level:3},{value:"4. Simulate the hypothesis test",id:"4-simulate-the-hypothesis-test",level:3},{value:"5. Conclusion",id:"5-conclusion",level:3},{value:"6. Extra",id:"6-extra",level:3}];function d(e){const t={admonition:"admonition",code:"code",h2:"h2",h3:"h3",hr:"hr",li:"li",ol:"ol",p:"p",pre:"pre",strong:"strong",ul:"ul",...(0,i.R)(),...e.components};return(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(t.h2,{id:"concept",children:"Concept"}),"\n",(0,n.jsx)(t.admonition,{title:"Key Idea",type:"tip",children:(0,n.jsx)(t.p,{children:"We use a hypothesis test to test whether a sample was drawn from a population."})}),"\n",(0,n.jsxs)(t.admonition,{title:"Terminology",type:"info",children:[(0,n.jsxs)(t.p,{children:[(0,n.jsx)(t.strong,{children:"Hypothesis Test"}),": A process that test whether a sample was drawn from a population, given a population distribution and a sample."]}),(0,n.jsx)(t.p,{children:"To conduct a hypothesis test:"}),(0,n.jsxs)(t.ol,{children:["\n",(0,n.jsx)(t.li,{children:"Simulate the experiment many times under the assumption that the null hypothesis is true."}),"\n",(0,n.jsx)(t.li,{children:"Compute a test statistic on each of the simulated samples, as well as on the observed sample."}),"\n",(0,n.jsx)(t.li,{children:"Look at the resulting empirical distribution of test statistics and see where the observed test statistic falls. If it seems like an atypical value (too large or too small), we reject the null hypothesis; otherwise, we fail to reject the null."}),"\n"]})]}),"\n",(0,n.jsx)(t.hr,{}),"\n",(0,n.jsx)(t.h2,{id:"code-example",children:"Code Example"}),"\n",(0,n.jsx)(t.h3,{id:"1-state-the-questionhypothesis",children:"1. State the question/hypothesis"}),"\n",(0,n.jsxs)(t.admonition,{title:"Hypotheses",type:"info",children:[(0,n.jsx)(t.p,{children:"Our pair of hypotheses is:"}),(0,n.jsxs)(t.ul,{children:["\n",(0,n.jsx)(t.li,{children:(0,n.jsx)(t.strong,{children:"Null Hypothesis:"})}),"\n",(0,n.jsx)(t.li,{children:(0,n.jsx)(t.strong,{children:"Alternative Hypothesis:"})}),"\n"]})]}),"\n",(0,n.jsx)(t.hr,{}),"\n",(0,n.jsx)(t.h3,{id:"2-query-the-dataframe",children:"2. Query the DataFrame"}),"\n",(0,n.jsx)(t.p,{children:"comment"}),"\n",(0,n.jsx)(t.pre,{children:(0,n.jsx)(t.code,{className:"language-python"})}),"\n",(0,n.jsx)(t.hr,{}),"\n",(0,n.jsx)(t.h3,{id:"3-create-a-function-to-calculate-test-statistic",children:"3. Create a function to calculate test statistic"}),"\n",(0,n.jsx)(t.p,{children:"comment"}),"\n",(0,n.jsx)(t.pre,{children:(0,n.jsx)(t.code,{className:"language-python"})}),"\n",(0,n.jsx)(t.hr,{}),"\n",(0,n.jsx)(t.h3,{id:"4-simulate-the-hypothesis-test",children:"4. Simulate the hypothesis test"}),"\n",(0,n.jsx)(t.pre,{children:(0,n.jsx)(t.code,{className:"language-python"})}),"\n",(0,n.jsx)(t.hr,{}),"\n",(0,n.jsx)(t.h3,{id:"5-conclusion",children:"5. Conclusion"}),"\n",(0,n.jsx)(t.pre,{children:(0,n.jsx)(t.code,{className:"language-python"})}),"\n",(0,n.jsxs)(t.p,{children:[(0,n.jsx)(t.strong,{children:"The observed value of the test statistic is:"})," ",(0,n.jsx)("br",{}),"\n",(0,n.jsx)(t.strong,{children:"The p-value is:"})]}),"\n",(0,n.jsx)(t.p,{children:"Using a significance level of 0.05:"}),"\n",(0,n.jsx)(t.admonition,{title:"Conclusion",type:"info"}),"\n",(0,n.jsx)(t.hr,{}),"\n",(0,n.jsx)(t.h3,{id:"6-extra",children:"6. Extra"}),"\n",(0,n.jsx)(t.p,{children:"Let's see how our observed statistic compares to the overall simulated values!"}),"\n",(0,n.jsx)(t.pre,{children:(0,n.jsx)(t.code,{className:"language-python",children:"# Create the histogram.\nbpd.DataFrame().assign(statistics=statistics).plot(kind='hist', bins=20, density=True, ec='w')\n# Don't worry about this line - you won't need to know it for this course!\nplt.axvline(x=observed, c='black', linewidth=4, label='population difference in means')\n"})})]})}function h(e={}){const{wrapper:t}={...(0,i.R)(),...e.components};return t?(0,n.jsx)(t,{...e,children:(0,n.jsx)(d,{...e})}):d(e)}},8597:(e,t,s)=>{s.d(t,{A:()=>i});s(6540);var n=s(4848);const i=e=>{let{data:t}=e,s=[],i=[],o="",r=[];if(t){const e=JSON.parse(t);s=e.columns||[],i=e.data||[],o=e.indexName||"Index",r=e.index||[]}return(0,n.jsx)("div",{className:"dataframe-container",children:(0,n.jsxs)("table",{className:"dataframe-table",children:[(0,n.jsx)("thead",{children:(0,n.jsxs)("tr",{children:[(0,n.jsx)("th",{children:o}),s.map(((e,t)=>(0,n.jsx)("th",{children:e},t)))]})}),(0,n.jsx)("tbody",{children:i.map(((e,t)=>(0,n.jsxs)("tr",{children:[(0,n.jsx)("td",{className:"index-value",children:r[t]}),e.map(((e,t)=>{return(0,n.jsx)("td",{children:(s=e,"boolean"==typeof s?s.toString().charAt(0).toUpperCase()+s.toString().slice(1):s)},t);var s}))]},t)))})]})})}},5158:(e,t,s)=>{s.d(t,{A:()=>o});var n=s(6540),i=s(4848);const o=function(e){let{src:t,sourceLink:s,width:o="100%",height:r="100%",paddingBottom:a="56.25%"}=e;const[l,c]=(0,n.useState)(0);return(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)("div",{style:{position:"relative",height:"0",paddingBottom:a,overflow:"hidden",maxWidth:"100%"},children:(0,i.jsx)("iframe",{src:t,style:{position:"absolute",top:0,left:0,width:o,height:r,frameBorder:"0",allowFullScreen:!0}},l)}),(0,i.jsx)("div",{style:{display:"flex",justifyContent:"center",margin:"20px 0"},children:(0,i.jsx)("a",{href:s,target:"_blank",rel:"noopener noreferrer",children:"(Source)"})}),(0,i.jsx)("div",{style:{display:"flex",justifyContent:"center",margin:"10px 0"},children:(0,i.jsx)("button",{onClick:()=>{c((e=>e+1))},style:{backgroundColor:"#4CAF50",color:"white",padding:"10px 20px",border:"none",borderRadius:"5px",cursor:"pointer",outline:"none",fontSize:"16px",fontWeight:"bold",boxShadow:"0 4px 8px rgba(0,0,0,0.1)",transition:"background-color 0.3s"},onMouseOver:e=>e.currentTarget.style.backgroundColor="#45a049",onMouseOut:e=>e.currentTarget.style.backgroundColor="#4CAF50",children:"Restart Diagram"})})]})}},8453:(e,t,s)=>{s.d(t,{R:()=>r,x:()=>a});var n=s(6540);const i={},o=n.createContext(i);function r(e){const t=n.useContext(o);return n.useMemo((function(){return"function"==typeof e?e(t):{...t,...e}}),[t,e])}function a(e){let t;return t=e.disableParentContext?"function"==typeof e.components?e.components(i):e.components||i:r(e.components),n.createElement(o.Provider,{value:t},e.children)}}}]); \ No newline at end of file diff --git a/assets/js/f03ae67e.db78e148.js b/assets/js/f03ae67e.db78e148.js new file mode 100644 index 00000000..008a2399 --- /dev/null +++ b/assets/js/f03ae67e.db78e148.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkbpd_reference=self.webpackChunkbpd_reference||[]).push([[972],{3007:(e,t,s)=>{s.r(t),s.d(t,{assets:()=>l,contentTitle:()=>o,default:()=>d,frontMatter:()=>a,metadata:()=>r,toc:()=>c});var n=s(4848),i=s(8453);s(8597),s(5158);const a={sidebar_position:6,sidebar_label:"Hypothesis Test",title:"Hypothesis Test",tags:["querying","functions","for-loop","histogram"]},o=void 0,r={id:"statistical-inference/hypothesis_test",title:"Hypothesis Test",description:"Concept",source:"@site/docs/statistical-inference/hypothesis_test.md",sourceDirName:"statistical-inference",slug:"/statistical-inference/hypothesis_test",permalink:"/bpd-reference/docs/statistical-inference/hypothesis_test",draft:!1,unlisted:!1,editUrl:"https://github.com/dsc-courses/bpd-reference/tree/main/docs/statistical-inference/hypothesis_test.md",tags:[{label:"querying",permalink:"/bpd-reference/docs/tags/querying"},{label:"functions",permalink:"/bpd-reference/docs/tags/functions"},{label:"for-loop",permalink:"/bpd-reference/docs/tags/for-loop"},{label:"histogram",permalink:"/bpd-reference/docs/tags/histogram"}],version:"current",sidebarPosition:6,frontMatter:{sidebar_position:6,sidebar_label:"Hypothesis Test",title:"Hypothesis Test",tags:["querying","functions","for-loop","histogram"]},sidebar:"statsSidebar",previous:{title:"P-value",permalink:"/bpd-reference/docs/statistical-inference/p_value"},next:{title:"Permutation Test",permalink:"/bpd-reference/docs/statistical-inference/permutation_test"}},l={},c=[{value:"Concept",id:"concept",level:2},{value:"Code Example",id:"code-example",level:2},{value:"1. State the question/hypothesis",id:"1-state-the-questionhypothesis",level:3},{value:"2. Query the DataFrame",id:"2-query-the-dataframe",level:3},{value:"3. Create a function to calculate test statistic",id:"3-create-a-function-to-calculate-test-statistic",level:3},{value:"4. Simulate the hypothesis test",id:"4-simulate-the-hypothesis-test",level:3},{value:"5. Conclusion",id:"5-conclusion",level:3},{value:"6. Extra",id:"6-extra",level:3}];function h(e){const t={admonition:"admonition",annotation:"annotation",code:"code",h2:"h2",h3:"h3",hr:"hr",li:"li",math:"math",mo:"mo",mrow:"mrow",ol:"ol",p:"p",pre:"pre",semantics:"semantics",span:"span",strong:"strong",ul:"ul",...(0,i.R)(),...e.components};return(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(t.h2,{id:"concept",children:"Concept"}),"\n",(0,n.jsx)(t.admonition,{title:"Key Idea",type:"tip",children:(0,n.jsx)(t.p,{children:"We use a hypothesis test to test whether a sample was drawn from a population."})}),"\n",(0,n.jsxs)(t.admonition,{title:"Terminology",type:"info",children:[(0,n.jsxs)(t.p,{children:[(0,n.jsx)(t.strong,{children:"Hypothesis Test"}),": A process that test whether a sample was drawn from a population, given a population distribution and a sample."]}),(0,n.jsx)(t.p,{children:"To conduct a hypothesis test:"}),(0,n.jsxs)(t.ol,{children:["\n",(0,n.jsx)(t.li,{children:"Simulate the experiment many times under the assumption that the null hypothesis is true."}),"\n",(0,n.jsx)(t.li,{children:"Compute a test statistic on each of the simulated samples, as well as on the observed sample."}),"\n",(0,n.jsx)(t.li,{children:"Look at the resulting empirical distribution of test statistics and see where the observed test statistic falls. If it seems like an atypical value (too large or too small), we reject the null hypothesis; otherwise, we fail to reject the null."}),"\n"]})]}),"\n",(0,n.jsx)(t.hr,{}),"\n",(0,n.jsx)(t.h2,{id:"code-example",children:"Code Example"}),"\n",(0,n.jsx)(t.h3,{id:"1-state-the-questionhypothesis",children:"1. State the question/hypothesis"}),"\n",(0,n.jsxs)(t.admonition,{title:"Hypotheses",type:"info",children:[(0,n.jsx)(t.p,{children:"We will test the following pair of hypotheses at the standard p = 0.05 significance level."}),(0,n.jsxs)(t.ul,{children:["\n",(0,n.jsxs)(t.li,{children:[(0,n.jsx)(t.strong,{children:"Null Hypothesis:"}),' The proportion of "golden" hamsters is equal to the proportion of "golden" pets in the overall population.']}),"\n",(0,n.jsxs)(t.li,{children:[(0,n.jsx)(t.strong,{children:"Alternative Hypothesis:"}),' The distribution of "golden" characters among hamsters is greater than the proportion of "golden" pets in the overall population.']}),"\n"]})]}),"\n",(0,n.jsxs)(t.p,{children:['Since the alternative hypothesis is of the form "A is greater than B," the ',(0,n.jsx)(t.strong,{children:"test statistic"})," should measure signed difference rather than absolute difference."]}),"\n",(0,n.jsxs)(t.p,{children:[(0,n.jsxs)(t.span,{className:"katex",children:[(0,n.jsx)(t.span,{className:"katex-mathml",children:(0,n.jsx)(t.math,{xmlns:"http://www.w3.org/1998/Math/MathML",children:(0,n.jsxs)(t.semantics,{children:[(0,n.jsx)(t.mrow,{children:(0,n.jsx)(t.mo,{children:"\u2234"})}),(0,n.jsx)(t.annotation,{encoding:"application/x-tex",children:"\\therefore"})]})})}),(0,n.jsx)(t.span,{className:"katex-html","aria-hidden":"true",children:(0,n.jsxs)(t.span,{className:"base",children:[(0,n.jsx)(t.span,{className:"strut",style:{height:"0.6922em"}}),(0,n.jsx)(t.span,{className:"mrel amsrm",children:"\u2234"})]})})]})," We use ",(0,n.jsx)(t.strong,{children:"the difference in proportions"})," of golden hamsters and golden pets in the overall population as the test statistic."]}),"\n",(0,n.jsx)(t.hr,{}),"\n",(0,n.jsx)(t.h3,{id:"2-query-the-dataframe",children:"2. Query the DataFrame"}),"\n",(0,n.jsx)(t.p,{children:"comment"}),"\n",(0,n.jsx)(t.pre,{children:(0,n.jsx)(t.code,{className:"language-python"})}),"\n",(0,n.jsx)(t.hr,{}),"\n",(0,n.jsx)(t.h3,{id:"3-create-a-function-to-calculate-test-statistic",children:"3. Create a function to calculate test statistic"}),"\n",(0,n.jsx)(t.p,{children:"comment"}),"\n",(0,n.jsx)(t.pre,{children:(0,n.jsx)(t.code,{className:"language-python"})}),"\n",(0,n.jsx)(t.hr,{}),"\n",(0,n.jsx)(t.h3,{id:"4-simulate-the-hypothesis-test",children:"4. Simulate the hypothesis test"}),"\n",(0,n.jsx)(t.pre,{children:(0,n.jsx)(t.code,{className:"language-python"})}),"\n",(0,n.jsx)(t.hr,{}),"\n",(0,n.jsx)(t.h3,{id:"5-conclusion",children:"5. Conclusion"}),"\n",(0,n.jsx)(t.pre,{children:(0,n.jsx)(t.code,{className:"language-python"})}),"\n",(0,n.jsxs)(t.p,{children:[(0,n.jsx)(t.strong,{children:"The observed value of the test statistic is:"})," ",(0,n.jsx)("br",{}),"\n",(0,n.jsx)(t.strong,{children:"The p-value is:"})]}),"\n",(0,n.jsx)(t.p,{children:"Using a significance level of 0.05:"}),"\n",(0,n.jsx)(t.admonition,{title:"Conclusion",type:"info"}),"\n",(0,n.jsx)(t.hr,{}),"\n",(0,n.jsx)(t.h3,{id:"6-extra",children:"6. Extra"}),"\n",(0,n.jsx)(t.p,{children:"Let's see how our observed statistic compares to the overall simulated values!"}),"\n",(0,n.jsx)(t.pre,{children:(0,n.jsx)(t.code,{className:"language-python",children:"# Create the histogram.\nbpd.DataFrame().assign(statistics=statistics).plot(kind='hist', bins=20, density=True, ec='w')\n# Don't worry about this line - you won't need to know it for this course!\nplt.axvline(x=observed, c='black', linewidth=4, label='population difference in means')\n"})})]})}function d(e={}){const{wrapper:t}={...(0,i.R)(),...e.components};return t?(0,n.jsx)(t,{...e,children:(0,n.jsx)(h,{...e})}):h(e)}},8597:(e,t,s)=>{s.d(t,{A:()=>i});s(6540);var n=s(4848);const i=e=>{let{data:t}=e,s=[],i=[],a="",o=[];if(t){const e=JSON.parse(t);s=e.columns||[],i=e.data||[],a=e.indexName||"Index",o=e.index||[]}return(0,n.jsx)("div",{className:"dataframe-container",children:(0,n.jsxs)("table",{className:"dataframe-table",children:[(0,n.jsx)("thead",{children:(0,n.jsxs)("tr",{children:[(0,n.jsx)("th",{children:a}),s.map(((e,t)=>(0,n.jsx)("th",{children:e},t)))]})}),(0,n.jsx)("tbody",{children:i.map(((e,t)=>(0,n.jsxs)("tr",{children:[(0,n.jsx)("td",{className:"index-value",children:o[t]}),e.map(((e,t)=>{return(0,n.jsx)("td",{children:(s=e,"boolean"==typeof s?s.toString().charAt(0).toUpperCase()+s.toString().slice(1):s)},t);var s}))]},t)))})]})})}},5158:(e,t,s)=>{s.d(t,{A:()=>a});var n=s(6540),i=s(4848);const a=function(e){let{src:t,sourceLink:s,width:a="100%",height:o="100%",paddingBottom:r="56.25%"}=e;const[l,c]=(0,n.useState)(0);return(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)("div",{style:{position:"relative",height:"0",paddingBottom:r,overflow:"hidden",maxWidth:"100%"},children:(0,i.jsx)("iframe",{src:t,style:{position:"absolute",top:0,left:0,width:a,height:o,frameBorder:"0",allowFullScreen:!0}},l)}),(0,i.jsx)("div",{style:{display:"flex",justifyContent:"center",margin:"20px 0"},children:(0,i.jsx)("a",{href:s,target:"_blank",rel:"noopener noreferrer",children:"(Source)"})}),(0,i.jsx)("div",{style:{display:"flex",justifyContent:"center",margin:"10px 0"},children:(0,i.jsx)("button",{onClick:()=>{c((e=>e+1))},style:{backgroundColor:"#4CAF50",color:"white",padding:"10px 20px",border:"none",borderRadius:"5px",cursor:"pointer",outline:"none",fontSize:"16px",fontWeight:"bold",boxShadow:"0 4px 8px rgba(0,0,0,0.1)",transition:"background-color 0.3s"},onMouseOver:e=>e.currentTarget.style.backgroundColor="#45a049",onMouseOut:e=>e.currentTarget.style.backgroundColor="#4CAF50",children:"Restart Diagram"})})]})}},8453:(e,t,s)=>{s.d(t,{R:()=>o,x:()=>r});var n=s(6540);const i={},a=n.createContext(i);function o(e){const t=n.useContext(a);return n.useMemo((function(){return"function"==typeof e?e(t):{...t,...e}}),[t,e])}function r(e){let t;return t=e.disableParentContext?"function"==typeof e.components?e.components(i):e.components||i:o(e.components),n.createElement(a.Provider,{value:t},e.children)}}}]); \ No newline at end of file diff --git a/assets/js/runtime~main.a9a9ad25.js b/assets/js/runtime~main.9fa575ec.js similarity index 98% rename from assets/js/runtime~main.a9a9ad25.js rename to assets/js/runtime~main.9fa575ec.js index 6a992321..4736fbba 100644 --- a/assets/js/runtime~main.a9a9ad25.js +++ b/assets/js/runtime~main.9fa575ec.js @@ -1 +1 @@ -(()=>{"use strict";var e,a,f,c,d,b={},r={};function t(e){var a=r[e];if(void 0!==a)return a.exports;var f=r[e]={id:e,loaded:!1,exports:{}};return b[e].call(f.exports,f,f.exports,t),f.loaded=!0,f.exports}t.m=b,t.c=r,e=[],t.O=(a,f,c,d)=>{if(!f){var b=1/0;for(i=0;i=d)&&Object.keys(t.O).every((e=>t.O[e](f[o])))?f.splice(o--,1):(r=!1,d0&&e[i-1][2]>d;i--)e[i]=e[i-1];e[i]=[f,c,d]},t.n=e=>{var a=e&&e.__esModule?()=>e.default:()=>e;return t.d(a,{a:a}),a},f=Object.getPrototypeOf?e=>Object.getPrototypeOf(e):e=>e.__proto__,t.t=function(e,c){if(1&c&&(e=this(e)),8&c)return e;if("object"==typeof e&&e){if(4&c&&e.__esModule)return e;if(16&c&&"function"==typeof e.then)return e}var d=Object.create(null);t.r(d);var b={};a=a||[null,f({}),f([]),f(f)];for(var r=2&c&&e;"object"==typeof r&&!~a.indexOf(r);r=f(r))Object.getOwnPropertyNames(r).forEach((a=>b[a]=()=>e[a]));return b.default=()=>e,t.d(d,b),d},t.d=(e,a)=>{for(var f in a)t.o(a,f)&&!t.o(e,f)&&Object.defineProperty(e,f,{enumerable:!0,get:a[f]})},t.f={},t.e=e=>Promise.all(Object.keys(t.f).reduce(((a,f)=>(t.f[f](e,a),a)),[])),t.u=e=>"assets/js/"+({28:"f095f4cd",94:"81322b72",186:"2869c049",614:"f2b0891e",675:"82ff9878",719:"9ac7dbcc",972:"f03ae67e",1316:"62552850",1607:"faf9f7da",1614:"e10a9913",1746:"a278cdf6",1779:"9a265863",1870:"ee019b1d",1903:"9e7aae35",1944:"b0c30e46",1972:"73664a40",1979:"b69909d7",2087:"f0fd5c00",2105:"dd3b6db1",2138:"1a4e3797",2284:"6e05dac9",2302:"499d47b2",2334:"65beeb93",2441:"9e1896f0",2491:"acb40918",2634:"c4f5d8e4",2646:"0c6397b1",2711:"9e4087bc",2720:"10f7d562",2808:"f0994678",2917:"dfefbedb",3237:"2be9118b",3249:"ccc49370",3279:"1fc0ff79",3342:"f9684ee2",3343:"f3b65525",3362:"f39390d7",3484:"c94468d5",3508:"202baea0",3555:"d3ef55ca",3637:"f4f34a3a",3694:"8717b14a",3717:"099c0b96",3782:"6e7a31fd",3870:"37002ad4",3985:"1cf20db4",4134:"393be207",4266:"8ded1294",4279:"df203c0f",4284:"acecf23e",4469:"6a26c916",4551:"907d0c45",4567:"655190df",4594:"62efbc4a",4638:"9746c0ef",4787:"3720c009",4812:"739bf370",4813:"6875c492",4833:"d4f68316",4929:"b78139e1",4932:"6b67e948",5007:"e06ba05c",5119:"d28047a2",5125:"10297ef4",5151:"55960ee5",5296:"14acb028",5387:"a934ee8a",5391:"cd451366",5427:"956f17b0",5443:"add9b02f",5480:"09399a2b",5521:"38b2e376",5557:"d9f32620",5579:"46ccc97a",5589:"ea885f1b",5622:"5d6a2894",5743:"231a3aa4",5745:"8d40581b",5980:"6e2ca103",6061:"1f391b9e",6077:"ffbcff43",6090:"3f791b14",6137:"61546123",6142:"60c4aef6",6280:"5ddb68ca",6363:"2141c98b",6690:"920988e2",6730:"b7ff327f",6747:"f4434bba",6925:"ecad1ce6",6969:"14eb3368",7069:"2efbf384",7098:"a7bd4aaa",7174:"a4805c9a",7214:"dcbe5aac",7233:"f4c1c84a",7326:"03f8d3d3",7472:"814f3328",7489:"fe41946a",7643:"a6aa9e1f",7661:"26533384",7680:"cdae2dcc",7889:"a16987a3",8065:"80770d40",8104:"d3196d0d",8209:"01a85c17",8241:"de98ccb0",8401:"17896441",8405:"6d7cf8c9",8559:"3349ad3a",8581:"935f2afb",8609:"925b3f96",8675:"809bd41b",8737:"7661071f",8857:"0708938a",9048:"a94703ab",9316:"3b87ebee",9325:"59362658",9328:"e273c56f",9572:"8c496670",9595:"fb17983f",9600:"eaaf288f",9647:"5e95c892",9699:"f9ea3bc3",9797:"85bbc213",9894:"9f1843d8",9933:"9c6685b1",9938:"3eb51302"}[e]||e)+"."+{28:"e4b62aed",94:"90d5758b",186:"7590b2dd",614:"d7eac5db",675:"9143662a",719:"77c0c128",972:"11dc796d",1316:"573949c4",1607:"a670a186",1614:"b87367c0",1746:"6d5ef8b3",1779:"d5fe33af",1870:"83c014e4",1903:"af9e1878",1944:"b30b68d3",1972:"6864c464",1979:"cf14dce4",2087:"4df4c5a5",2105:"3ea3e8be",2138:"aadba9b7",2237:"29af0789",2284:"5de02c24",2302:"394129d8",2334:"92288123",2441:"2e4217dc",2491:"20b35a67",2634:"9746cc75",2646:"4c026ca7",2711:"8dd0f02f",2720:"9b0bb4fc",2808:"c5bbc53b",2917:"f0f27122",3237:"1e62f3f0",3242:"bc6cfa22",3249:"ede845d6",3279:"6dd77478",3342:"94223911",3343:"559eee41",3362:"8c037730",3484:"c6edfbc0",3508:"908c6f0c",3555:"2308a0a5",3637:"b17e442f",3694:"5454028b",3717:"ce8ec948",3782:"37c8f8e9",3808:"8a31a624",3870:"787d30eb",3985:"a1948cc0",4134:"6cb884a7",4266:"513e7c38",4279:"9bb05a46",4284:"6510b036",4469:"af28a919",4551:"7e422b8d",4567:"23a73ffd",4594:"00648062",4638:"2880f7ec",4787:"9b65805f",4812:"a6284299",4813:"170acbab",4833:"3a5908d0",4929:"88fdbdc8",4932:"0e1c3290",5007:"2fc679a2",5049:"fc44c2c6",5119:"18ff2dbc",5125:"8f93c5d4",5151:"cb430b37",5296:"d858fe86",5387:"ae97e89f",5391:"27038027",5427:"95f66799",5443:"bf2acfd8",5480:"c91de645",5521:"3d83e140",5557:"9fd27735",5579:"c2d0e88e",5589:"9a7123df",5622:"ac62096c",5743:"bb1b0a14",5745:"0f3d989b",5980:"7621ee3b",6061:"0fbbc924",6077:"e95668eb",6090:"fee676c1",6137:"5a755d22",6142:"62dc7b2e",6280:"036894d0",6363:"8ceae88c",6690:"1a73d040",6730:"83d6c5cc",6747:"0479fbaa",6925:"45e66795",6969:"66f25eb3",7069:"0f6f23fb",7098:"7f57ba47",7174:"53481746",7214:"70a12792",7233:"5e4838cd",7326:"65063e2e",7472:"2a71da77",7489:"a8daece4",7643:"e66b5d79",7661:"ba125169",7680:"872a7974",7889:"423d1bcd",8065:"963345af",8104:"6355b501",8209:"9fbc266e",8241:"92417364",8401:"e72d0c45",8405:"81b437c0",8559:"33a087db",8581:"03c5496c",8609:"cba4ee15",8675:"0c13f0ab",8737:"8c73ff37",8857:"2a952354",8913:"a03b371c",9048:"be35ee30",9316:"65aa3284",9325:"777bc4c6",9328:"f95f7890",9462:"c36291a8",9572:"3ecad696",9595:"834f9bfa",9600:"10ee7159",9647:"c487ac59",9699:"fcf0e076",9797:"59604264",9894:"8fe7c9be",9933:"77d25a1f",9938:"ade32d2c"}[e]+".js",t.miniCssF=e=>{},t.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),t.o=(e,a)=>Object.prototype.hasOwnProperty.call(e,a),c={},d="bpd-reference:",t.l=(e,a,f,b)=>{if(c[e])c[e].push(a);else{var r,o;if(void 0!==f)for(var n=document.getElementsByTagName("script"),i=0;i{r.onerror=r.onload=null,clearTimeout(s);var d=c[e];if(delete c[e],r.parentNode&&r.parentNode.removeChild(r),d&&d.forEach((e=>e(f))),a)return a(f)},s=setTimeout(l.bind(null,void 0,{type:"timeout",target:r}),12e4);r.onerror=l.bind(null,r.onerror),r.onload=l.bind(null,r.onload),o&&document.head.appendChild(r)}},t.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},t.p="/bpd-reference/",t.gca=function(e){return e={17896441:"8401",26533384:"7661",59362658:"9325",61546123:"6137",62552850:"1316",f095f4cd:"28","81322b72":"94","2869c049":"186",f2b0891e:"614","82ff9878":"675","9ac7dbcc":"719",f03ae67e:"972",faf9f7da:"1607",e10a9913:"1614",a278cdf6:"1746","9a265863":"1779",ee019b1d:"1870","9e7aae35":"1903",b0c30e46:"1944","73664a40":"1972",b69909d7:"1979",f0fd5c00:"2087",dd3b6db1:"2105","1a4e3797":"2138","6e05dac9":"2284","499d47b2":"2302","65beeb93":"2334","9e1896f0":"2441",acb40918:"2491",c4f5d8e4:"2634","0c6397b1":"2646","9e4087bc":"2711","10f7d562":"2720",f0994678:"2808",dfefbedb:"2917","2be9118b":"3237",ccc49370:"3249","1fc0ff79":"3279",f9684ee2:"3342",f3b65525:"3343",f39390d7:"3362",c94468d5:"3484","202baea0":"3508",d3ef55ca:"3555",f4f34a3a:"3637","8717b14a":"3694","099c0b96":"3717","6e7a31fd":"3782","37002ad4":"3870","1cf20db4":"3985","393be207":"4134","8ded1294":"4266",df203c0f:"4279",acecf23e:"4284","6a26c916":"4469","907d0c45":"4551","655190df":"4567","62efbc4a":"4594","9746c0ef":"4638","3720c009":"4787","739bf370":"4812","6875c492":"4813",d4f68316:"4833",b78139e1:"4929","6b67e948":"4932",e06ba05c:"5007",d28047a2:"5119","10297ef4":"5125","55960ee5":"5151","14acb028":"5296",a934ee8a:"5387",cd451366:"5391","956f17b0":"5427",add9b02f:"5443","09399a2b":"5480","38b2e376":"5521",d9f32620:"5557","46ccc97a":"5579",ea885f1b:"5589","5d6a2894":"5622","231a3aa4":"5743","8d40581b":"5745","6e2ca103":"5980","1f391b9e":"6061",ffbcff43:"6077","3f791b14":"6090","60c4aef6":"6142","5ddb68ca":"6280","2141c98b":"6363","920988e2":"6690",b7ff327f:"6730",f4434bba:"6747",ecad1ce6:"6925","14eb3368":"6969","2efbf384":"7069",a7bd4aaa:"7098",a4805c9a:"7174",dcbe5aac:"7214",f4c1c84a:"7233","03f8d3d3":"7326","814f3328":"7472",fe41946a:"7489",a6aa9e1f:"7643",cdae2dcc:"7680",a16987a3:"7889","80770d40":"8065",d3196d0d:"8104","01a85c17":"8209",de98ccb0:"8241","6d7cf8c9":"8405","3349ad3a":"8559","935f2afb":"8581","925b3f96":"8609","809bd41b":"8675","7661071f":"8737","0708938a":"8857",a94703ab:"9048","3b87ebee":"9316",e273c56f:"9328","8c496670":"9572",fb17983f:"9595",eaaf288f:"9600","5e95c892":"9647",f9ea3bc3:"9699","85bbc213":"9797","9f1843d8":"9894","9c6685b1":"9933","3eb51302":"9938"}[e]||e,t.p+t.u(e)},(()=>{var e={5354:0,1869:0};t.f.j=(a,f)=>{var c=t.o(e,a)?e[a]:void 0;if(0!==c)if(c)f.push(c[2]);else if(/^(1869|5354)$/.test(a))e[a]=0;else{var d=new Promise(((f,d)=>c=e[a]=[f,d]));f.push(c[2]=d);var b=t.p+t.u(a),r=new Error;t.l(b,(f=>{if(t.o(e,a)&&(0!==(c=e[a])&&(e[a]=void 0),c)){var d=f&&("load"===f.type?"missing":f.type),b=f&&f.target&&f.target.src;r.message="Loading chunk "+a+" failed.\n("+d+": "+b+")",r.name="ChunkLoadError",r.type=d,r.request=b,c[1](r)}}),"chunk-"+a,a)}},t.O.j=a=>0===e[a];var a=(a,f)=>{var c,d,b=f[0],r=f[1],o=f[2],n=0;if(b.some((a=>0!==e[a]))){for(c in r)t.o(r,c)&&(t.m[c]=r[c]);if(o)var i=o(t)}for(a&&a(f);n{"use strict";var e,a,f,c,d,b={},r={};function t(e){var a=r[e];if(void 0!==a)return a.exports;var f=r[e]={id:e,loaded:!1,exports:{}};return b[e].call(f.exports,f,f.exports,t),f.loaded=!0,f.exports}t.m=b,t.c=r,e=[],t.O=(a,f,c,d)=>{if(!f){var b=1/0;for(i=0;i=d)&&Object.keys(t.O).every((e=>t.O[e](f[o])))?f.splice(o--,1):(r=!1,d0&&e[i-1][2]>d;i--)e[i]=e[i-1];e[i]=[f,c,d]},t.n=e=>{var a=e&&e.__esModule?()=>e.default:()=>e;return t.d(a,{a:a}),a},f=Object.getPrototypeOf?e=>Object.getPrototypeOf(e):e=>e.__proto__,t.t=function(e,c){if(1&c&&(e=this(e)),8&c)return e;if("object"==typeof e&&e){if(4&c&&e.__esModule)return e;if(16&c&&"function"==typeof e.then)return e}var d=Object.create(null);t.r(d);var b={};a=a||[null,f({}),f([]),f(f)];for(var r=2&c&&e;"object"==typeof r&&!~a.indexOf(r);r=f(r))Object.getOwnPropertyNames(r).forEach((a=>b[a]=()=>e[a]));return b.default=()=>e,t.d(d,b),d},t.d=(e,a)=>{for(var f in a)t.o(a,f)&&!t.o(e,f)&&Object.defineProperty(e,f,{enumerable:!0,get:a[f]})},t.f={},t.e=e=>Promise.all(Object.keys(t.f).reduce(((a,f)=>(t.f[f](e,a),a)),[])),t.u=e=>"assets/js/"+({28:"f095f4cd",94:"81322b72",186:"2869c049",614:"f2b0891e",675:"82ff9878",719:"9ac7dbcc",972:"f03ae67e",1316:"62552850",1607:"faf9f7da",1614:"e10a9913",1746:"a278cdf6",1779:"9a265863",1870:"ee019b1d",1903:"9e7aae35",1944:"b0c30e46",1972:"73664a40",1979:"b69909d7",2087:"f0fd5c00",2105:"dd3b6db1",2138:"1a4e3797",2284:"6e05dac9",2302:"499d47b2",2334:"65beeb93",2441:"9e1896f0",2491:"acb40918",2634:"c4f5d8e4",2646:"0c6397b1",2711:"9e4087bc",2720:"10f7d562",2808:"f0994678",2917:"dfefbedb",3237:"2be9118b",3249:"ccc49370",3279:"1fc0ff79",3342:"f9684ee2",3343:"f3b65525",3362:"f39390d7",3484:"c94468d5",3508:"202baea0",3555:"d3ef55ca",3637:"f4f34a3a",3694:"8717b14a",3717:"099c0b96",3782:"6e7a31fd",3870:"37002ad4",3985:"1cf20db4",4134:"393be207",4266:"8ded1294",4279:"df203c0f",4284:"acecf23e",4469:"6a26c916",4551:"907d0c45",4567:"655190df",4594:"62efbc4a",4638:"9746c0ef",4787:"3720c009",4812:"739bf370",4813:"6875c492",4833:"d4f68316",4929:"b78139e1",4932:"6b67e948",5007:"e06ba05c",5119:"d28047a2",5125:"10297ef4",5151:"55960ee5",5296:"14acb028",5387:"a934ee8a",5391:"cd451366",5427:"956f17b0",5443:"add9b02f",5480:"09399a2b",5521:"38b2e376",5557:"d9f32620",5579:"46ccc97a",5589:"ea885f1b",5622:"5d6a2894",5743:"231a3aa4",5745:"8d40581b",5980:"6e2ca103",6061:"1f391b9e",6077:"ffbcff43",6090:"3f791b14",6137:"61546123",6142:"60c4aef6",6280:"5ddb68ca",6363:"2141c98b",6690:"920988e2",6730:"b7ff327f",6747:"f4434bba",6925:"ecad1ce6",6969:"14eb3368",7069:"2efbf384",7098:"a7bd4aaa",7174:"a4805c9a",7214:"dcbe5aac",7233:"f4c1c84a",7326:"03f8d3d3",7472:"814f3328",7489:"fe41946a",7643:"a6aa9e1f",7661:"26533384",7680:"cdae2dcc",7889:"a16987a3",8065:"80770d40",8104:"d3196d0d",8209:"01a85c17",8241:"de98ccb0",8401:"17896441",8405:"6d7cf8c9",8559:"3349ad3a",8581:"935f2afb",8609:"925b3f96",8675:"809bd41b",8737:"7661071f",8857:"0708938a",9048:"a94703ab",9316:"3b87ebee",9325:"59362658",9328:"e273c56f",9572:"8c496670",9595:"fb17983f",9600:"eaaf288f",9647:"5e95c892",9699:"f9ea3bc3",9797:"85bbc213",9894:"9f1843d8",9933:"9c6685b1",9938:"3eb51302"}[e]||e)+"."+{28:"e4b62aed",94:"90d5758b",186:"7590b2dd",614:"d7eac5db",675:"9143662a",719:"77c0c128",972:"db78e148",1316:"573949c4",1607:"a670a186",1614:"b87367c0",1746:"6d5ef8b3",1779:"d5fe33af",1870:"83c014e4",1903:"af9e1878",1944:"b30b68d3",1972:"6864c464",1979:"cf14dce4",2087:"4df4c5a5",2105:"3ea3e8be",2138:"aadba9b7",2237:"29af0789",2284:"5de02c24",2302:"394129d8",2334:"92288123",2441:"2e4217dc",2491:"20b35a67",2634:"9746cc75",2646:"4c026ca7",2711:"8dd0f02f",2720:"9b0bb4fc",2808:"c5bbc53b",2917:"f0f27122",3237:"1e62f3f0",3242:"bc6cfa22",3249:"ede845d6",3279:"6dd77478",3342:"94223911",3343:"559eee41",3362:"8c037730",3484:"c6edfbc0",3508:"908c6f0c",3555:"2308a0a5",3637:"b17e442f",3694:"5454028b",3717:"ce8ec948",3782:"37c8f8e9",3808:"8a31a624",3870:"787d30eb",3985:"a1948cc0",4134:"6cb884a7",4266:"513e7c38",4279:"9bb05a46",4284:"6510b036",4469:"af28a919",4551:"7e422b8d",4567:"23a73ffd",4594:"00648062",4638:"2880f7ec",4787:"9b65805f",4812:"a6284299",4813:"170acbab",4833:"3a5908d0",4929:"88fdbdc8",4932:"0e1c3290",5007:"2fc679a2",5049:"fc44c2c6",5119:"18ff2dbc",5125:"8f93c5d4",5151:"cb430b37",5296:"d858fe86",5387:"ae97e89f",5391:"27038027",5427:"95f66799",5443:"bf2acfd8",5480:"c91de645",5521:"3d83e140",5557:"9fd27735",5579:"c2d0e88e",5589:"9a7123df",5622:"ac62096c",5743:"bb1b0a14",5745:"0f3d989b",5980:"7621ee3b",6061:"0fbbc924",6077:"e95668eb",6090:"fee676c1",6137:"5a755d22",6142:"e958a07e",6280:"036894d0",6363:"8ceae88c",6690:"1a73d040",6730:"83d6c5cc",6747:"0479fbaa",6925:"45e66795",6969:"66f25eb3",7069:"0f6f23fb",7098:"7f57ba47",7174:"53481746",7214:"70a12792",7233:"5e4838cd",7326:"65063e2e",7472:"2a71da77",7489:"a8daece4",7643:"e66b5d79",7661:"ba125169",7680:"872a7974",7889:"423d1bcd",8065:"963345af",8104:"6355b501",8209:"9fbc266e",8241:"92417364",8401:"e72d0c45",8405:"81b437c0",8559:"33a087db",8581:"03c5496c",8609:"cba4ee15",8675:"0c13f0ab",8737:"8c73ff37",8857:"2a952354",8913:"a03b371c",9048:"be35ee30",9316:"65aa3284",9325:"777bc4c6",9328:"f95f7890",9462:"c36291a8",9572:"3ecad696",9595:"834f9bfa",9600:"10ee7159",9647:"c487ac59",9699:"fcf0e076",9797:"59604264",9894:"3bede0c7",9933:"77d25a1f",9938:"ade32d2c"}[e]+".js",t.miniCssF=e=>{},t.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),t.o=(e,a)=>Object.prototype.hasOwnProperty.call(e,a),c={},d="bpd-reference:",t.l=(e,a,f,b)=>{if(c[e])c[e].push(a);else{var r,o;if(void 0!==f)for(var n=document.getElementsByTagName("script"),i=0;i{r.onerror=r.onload=null,clearTimeout(s);var d=c[e];if(delete c[e],r.parentNode&&r.parentNode.removeChild(r),d&&d.forEach((e=>e(f))),a)return a(f)},s=setTimeout(l.bind(null,void 0,{type:"timeout",target:r}),12e4);r.onerror=l.bind(null,r.onerror),r.onload=l.bind(null,r.onload),o&&document.head.appendChild(r)}},t.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},t.p="/bpd-reference/",t.gca=function(e){return e={17896441:"8401",26533384:"7661",59362658:"9325",61546123:"6137",62552850:"1316",f095f4cd:"28","81322b72":"94","2869c049":"186",f2b0891e:"614","82ff9878":"675","9ac7dbcc":"719",f03ae67e:"972",faf9f7da:"1607",e10a9913:"1614",a278cdf6:"1746","9a265863":"1779",ee019b1d:"1870","9e7aae35":"1903",b0c30e46:"1944","73664a40":"1972",b69909d7:"1979",f0fd5c00:"2087",dd3b6db1:"2105","1a4e3797":"2138","6e05dac9":"2284","499d47b2":"2302","65beeb93":"2334","9e1896f0":"2441",acb40918:"2491",c4f5d8e4:"2634","0c6397b1":"2646","9e4087bc":"2711","10f7d562":"2720",f0994678:"2808",dfefbedb:"2917","2be9118b":"3237",ccc49370:"3249","1fc0ff79":"3279",f9684ee2:"3342",f3b65525:"3343",f39390d7:"3362",c94468d5:"3484","202baea0":"3508",d3ef55ca:"3555",f4f34a3a:"3637","8717b14a":"3694","099c0b96":"3717","6e7a31fd":"3782","37002ad4":"3870","1cf20db4":"3985","393be207":"4134","8ded1294":"4266",df203c0f:"4279",acecf23e:"4284","6a26c916":"4469","907d0c45":"4551","655190df":"4567","62efbc4a":"4594","9746c0ef":"4638","3720c009":"4787","739bf370":"4812","6875c492":"4813",d4f68316:"4833",b78139e1:"4929","6b67e948":"4932",e06ba05c:"5007",d28047a2:"5119","10297ef4":"5125","55960ee5":"5151","14acb028":"5296",a934ee8a:"5387",cd451366:"5391","956f17b0":"5427",add9b02f:"5443","09399a2b":"5480","38b2e376":"5521",d9f32620:"5557","46ccc97a":"5579",ea885f1b:"5589","5d6a2894":"5622","231a3aa4":"5743","8d40581b":"5745","6e2ca103":"5980","1f391b9e":"6061",ffbcff43:"6077","3f791b14":"6090","60c4aef6":"6142","5ddb68ca":"6280","2141c98b":"6363","920988e2":"6690",b7ff327f:"6730",f4434bba:"6747",ecad1ce6:"6925","14eb3368":"6969","2efbf384":"7069",a7bd4aaa:"7098",a4805c9a:"7174",dcbe5aac:"7214",f4c1c84a:"7233","03f8d3d3":"7326","814f3328":"7472",fe41946a:"7489",a6aa9e1f:"7643",cdae2dcc:"7680",a16987a3:"7889","80770d40":"8065",d3196d0d:"8104","01a85c17":"8209",de98ccb0:"8241","6d7cf8c9":"8405","3349ad3a":"8559","935f2afb":"8581","925b3f96":"8609","809bd41b":"8675","7661071f":"8737","0708938a":"8857",a94703ab:"9048","3b87ebee":"9316",e273c56f:"9328","8c496670":"9572",fb17983f:"9595",eaaf288f:"9600","5e95c892":"9647",f9ea3bc3:"9699","85bbc213":"9797","9f1843d8":"9894","9c6685b1":"9933","3eb51302":"9938"}[e]||e,t.p+t.u(e)},(()=>{var e={5354:0,1869:0};t.f.j=(a,f)=>{var c=t.o(e,a)?e[a]:void 0;if(0!==c)if(c)f.push(c[2]);else if(/^(1869|5354)$/.test(a))e[a]=0;else{var d=new Promise(((f,d)=>c=e[a]=[f,d]));f.push(c[2]=d);var b=t.p+t.u(a),r=new Error;t.l(b,(f=>{if(t.o(e,a)&&(0!==(c=e[a])&&(e[a]=void 0),c)){var d=f&&("load"===f.type?"missing":f.type),b=f&&f.target&&f.target.src;r.message="Loading chunk "+a+" failed.\n("+d+": "+b+")",r.name="ChunkLoadError",r.type=d,r.request=b,c[1](r)}}),"chunk-"+a,a)}},t.O.j=a=>0===e[a];var a=(a,f)=>{var c,d,b=f[0],r=f[1],o=f[2],n=0;if(b.some((a=>0!==e[a]))){for(c in r)t.o(r,c)&&(t.m[c]=r[c]);if(o)var i=o(t)}for(a&&a(f);n