PageSourceSearch

https://www.stats4stem.org/_next/static/chunks/86608.377822e63928e867.js

js stats4stem.org collected 2026-10-07 18:04:33 UTC 10,271 bytes, 1 lines download raw bytes

1"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[86608],{64227:(e,t,s)=>{s.r(t),s.d(t,{default:()=>m});var a=s(95155),l=s(12115);function r(e,t){return Math.exp(n((t+1)/2)-n(t/2)-.5*Math.log(t*Math.PI))*Math.pow(1+e*e/t,-(t+1)/2)}function n(e){if(e<=0)return 0;if(e<7){let t=1,s=e;for(;s<7;)t*=s,s+=1;return n(s)-Math.log(t)}return(e-.5)*Math.log(e)-e+.5*Math.log(2*Math.PI)+(1/(12*e)-1/(360*e*e*e)+1/(1260*e*e*e*e*e))}function c(e,t){if(t>=100){let t=1/(1+.2316419*Math.abs(e)),s=.3989422804014327*Math.exp(-e*e/2)*(t*(.3193815+t*(-.3565638+t*(1.781478+t*(-1.821256+1.3302744*t)))));return e>0?1-s:s}let s=Math.min(e,10);if(s<=-10)return 0;let a=(s- -10)/2e3,l=0;for(let e=0;e<=2e3;e++){let s=-10+e*a;l+=(0===e||2e3===e?.5:1)*r(s,t)}return Math.max(0,Math.min(1,l*a))}function o(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:4;return e.toFixed(t)}let d={left:50,right:40,top:20,bottom:40},i=700-d.left-d.right,x=220-d.top-d.bottom,h=[.01,.05,.1];function m(){let[e,t]=(0,l.useState)(25),[s,n]=(0,l.useState)(84),[m,u]=(0,l.useState)(12),[p,b]=(0,l.useState)(30),[j,g]=(0,l.useState)(78),[f,v]=(0,l.useState)(10),[N,y]=(0,l.useState)(.05),[M,k]=(0,l.useState)("two-sided"),[w,S]=(0,l.useState)({state:!0,plan:!0,do:!0,conclude:!0}),C=e=>S(t=>({...t,[e]:!t[e]})),H=s-j,L=Math.sqrt(m*m/e+f*f/p),T=function(e,t,s,a){let l=e*e/t,r=s*s/a;return Math.floor((l+r)**2/(l*l/(t-1)+r*r/(a-1)))}(m,e,f,p),W=L>0?H/L:0,_=function(e,t,s){switch(s){case"less":return c(e,t);case"greater":return 1-c(e,t);case"two-sided":return 2*Math.min(c(e,t),1-c(e,t))}}(W,T,M),A=_<N,E=e>=30,G=p>=30,P=1.15*r(0,T),B=(0,l.useCallback)(e=>d.left+(e- -4)/8*i,[]),D=(0,l.useCallback)(e=>d.top+x-e/P*x,[P]),F=(0,l.useMemo)(()=>{let e=[];for(let t=0;t<=300;t++){let s=-4+t/300*8;e.push({x:s,y:r(s,T)})}return e},[T]),I=(0,l.useMemo)(()=>F.map((e,t)=>"".concat(0===t?"M":"L").concat(B(e.x),",").concat(D(e.y))).join(" "),[F,B,D]),R=(0,l.useMemo)(()=>{let e=(e,t)=>{let s=Math.max(e,-4),a=Math.min(t,4),l=["".concat(B(s),",").concat(D(0))];for(let e=0;e<=100;e++){let t=s+e/100*(a-s);l.push("".concat(B(t),",").concat(D(r(t,T))))}return l.push("".concat(B(a),",").concat(D(0))),"M".concat(l.join(" L"),"Z")},t=Math.max(-4,Math.min(4,W));switch(M){case"less":return e(-4,t);case"greater":return e(t,4);case"two-sided":return"".concat(e(-4,-Math.abs(t))," ").concat(e(Math.abs(t),4))}},[M,W,T,B,D]),q="less"===M?"<":"greater"===M?">":"≠",Z=e=>(0,a.jsx)("span",{className:e?"text-green-600":"text-red-500",children:e?"✓":"✗"}),z=(e,t)=>(0,a.jsxs)("button",{onClick:()=>C(e),className:"flex w-full items-center gap-2 rounded-md bg-slate-100 px-3 py-2 text-left text-sm font-semibold text-slate-700 hover:bg-slate-200 transition-colors",children:[(0,a.jsx)("span",{className:"text-xs text-slate-400",children:w[e]?"▼":"▶"}),t]});return(0,a.jsxs)("div",{className:"mx-auto max-w-5xl space-y-4 p-4 font-sans",children:[(0,a.jsx)("h2",{className:"text-lg font-bold text-slate-800",children:"Two-Sample t-Test for μ₁ − μ₂"}),(0,a.jsxs)("div",{className:"grid gap-6 lg:grid-cols-[320px_1fr]",children:[(0,a.jsxs)("div",{className:"space-y-4 rounded-lg border border-slate-200 bg-white p-4 shadow-sm",children:[(0,a.jsxs)("div",{className:"space-y-2",children:[(0,a.jsx)("span",{className:"inline-block rounded bg-blue-100 px-2 py-0.5 text-xs font-semibold text-blue-700",children:"Group 1"}),(0,a.jsxs)("div",{className:"grid grid-cols-3 gap-2",children:[(0,a.jsxs)("label",{className:"text-xs text-slate-600",children:["n₁",(0,a.jsx)("input",{type:"number",min:2,value:e,onChange:e=>t(Math.max(2,+e.target.value)),className:"mt-0.5 block w-full rounded border border-slate-300 px-2 py-1 text-sm"})]}),(0,a.jsxs)("label",{className:"text-xs text-slate-600",children:["x̄₁",(0,a.jsx)("input",{type:"number",step:.1,value:s,onChange:e=>n(+e.target.value),className:"mt-0.5 block w-full rounded border border-slate-300 px-2 py-1 text-sm"})]}),(0,a.jsxs)("label",{className:"text-xs text-slate-600",children:["s₁",(0,a.jsx)("input",{type:"number",step:.1,min:.01,value:m,onChange:e=>u(Math.max(.01,+e.target.value)),className:"mt-0.5 block w-full rounded border border-slate-300 px-2 py-1 text-sm"})]})]})]}),(0,a.jsxs)("div",{className:"space-y-2",children:[(0,a.jsx)("span",{className:"inline-block rounded bg-amber-100 px-2 py-0.5 text-xs font-semibold text-amber-700",children:"Group 2"}),(0,a.jsxs)("div",{className:"grid grid-cols-3 gap-2",children:[(0,a.jsxs)("label",{className:"text-xs text-slate-600",children:["n₂",(0,a.jsx)("input",{type:"number",min:2,value:p,onChange:e=>b(Math.max(2,+e.target.value)),className:"mt-0.5 block w-full rounded border border-slate-300 px-2 py-1 text-sm"})]}),(0,a.jsxs)("label",{className:"text-xs text-slate-600",children:["x̄₂",(0,a.jsx)("input",{type:"number",step:.1,value:j,onChange:e=>g(+e.target.value),className:"mt-0.5 block w-full rounded border border-slate-300 px-2 py-1 text-sm"})]}),(0,a.jsxs)("label",{className:"text-xs text-slate-600",children:["s₂",(0,a.jsx)("input",{type:"number",step:.1,min:.01,value:f,onChange:e=>v(Math.max(.01,+e.target.value)),className:"mt-0.5 block w-full rounded border border-slate-300 px-2 py-1 text-sm"})]})]})]}),(0,a.jsxs)("label",{className:"block text-xs text-slate-600",children:["Significance Level (α)",(0,a.jsx)("select",{value:N,onChange:e=>y(+e.target.value),className:"mt-0.5 block w-full rounded border border-slate-300 px-2 py-1 text-sm",children:h.map(e=>(0,a.jsxs)("option",{value:e,children:["α = ",e]},e))})]}),(0,a.jsxs)("label",{className:"block text-xs text-slate-600",children:["Alternative Hypothesis (Hₐ)",(0,a.jsxs)("select",{value:M,onChange:e=>k(e.target.value),className:"mt-0.5 block w-full rounded border border-slate-300 px-2 py-1 text-sm",children:[(0,a.jsx)("option",{value:"two-sided",children:"μ₁ ≠ μ₂ (two-sided)"}),(0,a.jsx)("option",{value:"less",children:"μ₁ < μ₂ (left-tailed)"}),(0,a.jsx)("option",{value:"greater",children:"μ₁ > μ₂ (right-tailed)"})]})]})]}),(0,a.jsxs)("div",{className:"space-y-3 rounded-lg border border-slate-200 bg-white p-4 shadow-sm",children:[z("state","State"),w.state&&(0,a.jsxs)("div",{className:"pl-4 text-sm text-slate-700 space-y-1",children:[(0,a.jsxs)("p",{children:[(0,a.jsx)("strong",{children:"H₀:"})," μ₁ = μ₂ (μ₁ − μ₂ = 0)"]}),(0,a.jsxs)("p",{children:[(0,a.jsx)("strong",{children:"Hₐ:"})," μ₁ ",q," μ₂"]}),(0,a.jsxs)("p",{children:["Significance level: α = ",N]})]}),z("plan","Plan"),w.plan&&(0,a.jsxs)("div",{className:"pl-4 text-sm text-slate-700 space-y-2",children:[(0,a.jsx)("p",{className:"font-medium",children:"Procedure: Two-sample t-test for μ₁ − μ₂"}),(0,a.jsxs)("div",{className:"space-y-1 text-xs",children:[(0,a.jsx)("p",{className:"font-medium text-slate-600",children:"Conditions:"}),(0,a.jsxs)("ul",{className:"space-y-0.5 pl-2",children:[(0,a.jsxs)("li",{children:[Z(!0)," Random: Both samples are randomly selected (assumed)"]}),(0,a.jsxs)("li",{children:[Z(E)," Normal/Large Sample (Group 1): n₁ ="," ",e," ",E?"≥ 30":"< 30 — 
1check for normality"]}),(0,a.jsxs)("li",{children:[Z(G)," Normal/Large Sample (Group 2): n₂ ="," ",p," ",G?"≥ 30":"< 30 — check for normality"]}),(0,a.jsxs)("li",{children:[Z(!0)," 10% condition: Both n₁ and n₂ are less than 10% of their populations (assumed)"]})]})]})]}),z("do","Do"),w.do&&(0,a.jsx)("div",{className:"pl-4 text-sm text-slate-700 space-y-2",children:(0,a.jsxs)("div",{className:"rounded bg-slate-50 p-3 font-mono text-xs space-y-1",children:[(0,a.jsxs)("p",{children:["x̄₁ − x̄₂ = ",o(s,2)," − ",o(j,2)," = ",o(H,4)]}),(0,a.jsx)("p",{children:"SE = √(s₁\xb2/n₁ + s₂\xb2/n₂)"}),(0,a.jsxs)("p",{className:"pl-4",children:["= √(",o(m,2),"\xb2/",e," + ",o(f,2),"\xb2/",p,")"]}),(0,a.jsxs)("p",{className:"pl-4",children:["= ",o(L)]}),(0,a.jsxs)("p",{children:["df (Welch's) = ",T]}),(0,a.jsxs)("p",{children:["t = (x̄₁ − x̄₂) / SE = ",o(H)," / ",o(L)," ="," ",o(W,3)]}),(0,a.jsxs)("p",{className:"mt-2 font-semibold",children:["p-value ≈ ",_<1e-4?"< 0.0001":o(_)]})]})}),z("conclude","Conclude"),w.conclude&&(0,a.jsxs)("div",{className:"pl-4 text-sm text-slate-700 space-y-2",children:[(0,a.jsxs)("p",{children:["Since the p-value (",_<1e-4?"< 0.0001":o(_),") is"," ",(0,a.jsx)("strong",{children:A?"less than α = ".concat(N):"not less than α = ".concat(N)}),", we"," ",(0,a.jsx)("strong",{children:A?"reject":"fail to reject"})," H₀."]}),(0,a.jsx)("div",{className:"rounded px-3 py-2 text-xs font-medium ".concat(A?"bg-green-50 text-green-700 border border-green-200":"bg-amber-50 text-amber-700 border border-amber-200"),children:A?"There is convincing evidence that μ₁ ".concat(q," μ₂ at the α = ").concat(N," level."):"There is not convincing evidence that μ₁ ".concat(q," μ₂ at the α = ").concat(N," level.")})]})]})]}),(0,a.jsxs)("div",{className:"rounded-lg border border-slate-200 bg-white p-4 shadow-sm",children:[(0,a.jsxs)("h3",{className:"mb-2 text-sm font-semibold text-slate-700",children:["t-Distribution (df = ",T,") — p-value"]}),(0,a.jsxs)("svg",{viewBox:"0 0 ".concat(700," ").concat(220),className:"w-full",style:{maxHeight:260},children:[R&&(0,a.jsx)("path",{d:R,fill:"rgba(239,68,68,0.25)",stroke:"none"}),(0,a.jsx)("path",{d:I,fill:"none",stroke:"#334155",strokeWidth:2}),(0,a.jsx)("line",{x1:d.left,y1:D(0),x2:700-d.right,y2:D(0),stroke:"#94a3b8",strokeWidth:1}),[-3,-2,-1,0,1,2,3].map(e=>(0,a.jsxs)("g",{children:[(0,a.jsx)("line",{x1:B(e),y1:D(0),x2:B(e),y2:D(0)+6,stroke:"#94a3b8",strokeWidth:1}),(0,a.jsx)("text",{x:B(e),y:D(0)+18,textAnchor:"middle",className:"text-[10px] fill-slate-500",children:e})]},e)),4>=Math.abs(W)&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)("line",{x1:B(W),y1:D(r(W,T)),x2:B(W),y2:D(0),stroke:"#dc2626",strokeWidth:2,strokeDasharray:"4,3"}),(0,a.jsxs)("text",{x:B(W),y:D(r(W,T))-8,textAnchor:"middle",className:"text-[11px] fill-red-600 font-semibold",children:["t = ",o(W,3)]})]}),(0,a.jsxs)("text",{x:350,y:214,textAnchor:"middle",className:"text-[11px] font-medium ".concat(A?"fill-red-600":"fill-slate-500"),children:["p-value ≈ ",_<1e-4?"< 0.0001":o(_)," | α ="," ",N," |"," ",A?"Reject H₀":"Fail to reject H₀"]})]})]})]})}}}]);

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.