Skip to content

Commit d4f7d27

Browse files
committed
Remove null hypothesis choice
1 parent e34caa8 commit d4f7d27

File tree

7 files changed

+62
-157
lines changed

7 files changed

+62
-157
lines changed

cypress/e2e/2.Sim1/sim1.cy.js

Lines changed: 1 addition & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,6 @@ describe('Simulation 1 Initial Setup', () => {
2424
cy.get('h2.h2-primary').should(
2525
'contain', 'Resulting graph coefficients');
2626
});
27-
it('should navigate to the null hypothesis section', () => {
28-
cy.get('[data-cy="nullNextButton"]').click();
29-
cy.get('h2.h2-primary').should('contain', 'Defining null hypothesis');
30-
});
3127
});
3228

3329
describe('Graph Data', () => {
@@ -39,27 +35,15 @@ describe('Graph Data', () => {
3935
cy.get('h2.h2-primary')
4036
.should('contain', 'Resulting graph coefficients');
4137
});
42-
it('Null Hypothesis', () => {
43-
cy.get('[data-cy="nullNextButton"]').click();
44-
cy.get('h2.h2-primary')
45-
.should('contain', 'Defining null hypothesis');
46-
});
4738
});
4839

4940
describe('Null Hypothesis', () => {
5041
it('should navigate through resulting graph coefficients', () => {
51-
cy.get('[data-cy="nullNextButton"]').click();
5242
cy.get('#null-hypothesis').should(
5343
'contain', 'Defining null hypothesis');
5444
});
55-
it('should allow selecting a different null hypothesis', () => {
56-
cy.get('button').contains('Continue').first().click();
57-
cy.get('input[name="nullHypothesis"]').clear();
58-
cy.get('input[name="nullHypothesis"]').type('1');
59-
cy.get('input[name="nullHypothesis"]').should('have.value', '1');
60-
});
6145

62-
it('should submit the selected hypothesis and proceed', () => {
46+
it('should move on to alternative hypothesis', () => {
6347
cy.get('button').contains('Continue').first().click();
6448
cy.get('#gotoTesting2d').click();
6549
cy.get('#quiz-1').should('contain', 'Alternative hypothesis');

media/js/src/simulations/simulation1/graphCoefficientsSection.jsx

Lines changed: 2 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,8 @@ import PropTypes from 'prop-types';
44

55
export const GraphCoefficients = ({
66
intercept, slope, stderror, plotType, slopes, stderrs,
7-
onShowNullHypothesis, intercept3d, showNullHypothesis
7+
intercept3d,
88
}) => {
9-
const handleNextClick = () => {
10-
onShowNullHypothesis();
11-
};
129

1310
return (
1411
<div className="simulation__step-container d-flex">
@@ -62,14 +59,6 @@ export const GraphCoefficients = ({
6259
`{SE(\\hat{\\beta_1})} = ${stderror.toFixed(3)}`} />
6360
</div>
6461
</div>
65-
<div className="simulation__step-prompt">
66-
<button className="btn btn-sm btn-success"
67-
data-cy="nullNextButton"
68-
disabled={showNullHypothesis}
69-
onClick={handleNextClick}>
70-
Continue &raquo;
71-
</button>
72-
</div>
7362
</div>
7463
)}
7564
{(plotType === '3d' && slopes.length > 0) && (
@@ -120,14 +109,6 @@ export const GraphCoefficients = ({
120109
`{SE(\\hat{\\beta_1})} = ${stderrs[0].toFixed(3)}`} />
121110
</div>
122111
</div>
123-
<div className="simulation__step-prompt">
124-
<button className="btn btn-sm btn-success"
125-
data-cy="nullNextButton"
126-
disabled={showNullHypothesis}
127-
onClick={handleNextClick}>
128-
Continue &raquo;
129-
</button>
130-
</div>
131112
</div>
132113
)}
133114
</div>
@@ -142,7 +123,5 @@ GraphCoefficients.propTypes = {
142123
plotType: PropTypes.string,
143124
slopes: PropTypes.array,
144125
stderrs: PropTypes.array,
145-
onShowNullHypothesis: PropTypes.func,
146-
intercept3d: PropTypes.number,
147-
showNullHypothesis: PropTypes.bool,
126+
intercept3d: PropTypes.number
148127
};

media/js/src/simulations/simulation1/hypothesisTest.jsx

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import { Quiz } from './quiz';
55
import axios from 'axios';
66

77
export const HypothesisTest = ({
8-
selectedAltHypothesis, appRvalue, tvalue, hypothesizedSlope, n,
8+
selectedAltHypothesis, appRvalue, tvalue, n,
99
completedChoices, submissionId, plotType, isRedo, setIsRedo,
1010
setIsHypothesisCompleted, isHypothesisCompleted, answers, setLockControls
1111
}) => {
@@ -16,19 +16,19 @@ export const HypothesisTest = ({
1616
let hypothesis;
1717
let hypothesisTest;
1818

19-
const nullHypothesis = `\\Eta_0: {\\beta_1}=${hypothesizedSlope}`;
19+
const nullHypothesis = `\\Eta_0: {\\beta_1}= 0`;
2020

2121
switch (selectedAltHypothesis) {
2222
case 'A':
23-
hypothesis = `\\Eta_1: {\\beta_1}~{\\neq}~${hypothesizedSlope}`;
23+
hypothesis = `\\Eta_1: {\\beta_1}~{\\neq}~0`;
2424
hypothesisTest = 'value_two_sided';
2525
break;
2626
case 'B':
27-
hypothesis = `\\Eta_1: {\\beta_1}~{\\gt}~${hypothesizedSlope}`;
27+
hypothesis = `\\Eta_1: {\\beta_1}~{\\gt}~0`;
2828
hypothesisTest = 'value_right';
2929
break;
3030
case 'C':
31-
hypothesis = `\\Eta_1: {\\beta_1}~{\\lt}~${hypothesizedSlope}`;
31+
hypothesis = `\\Eta_1: {\\beta_1}~{\\lt}~0`;
3232
hypothesisTest = 'value_left';
3333
break;
3434
default:
@@ -188,7 +188,6 @@ HypothesisTest.propTypes = {
188188
appRvalue: PropTypes.number.isRequired,
189189
tvalue: PropTypes.number.isRequired,
190190
coursePK: PropTypes.number,
191-
hypothesizedSlope: PropTypes.any.isRequired,
192191
n: PropTypes.number.isRequired,
193192
completedChoices: PropTypes.array.isRequired,
194193
submissionId: PropTypes.number.isRequired,

media/js/src/simulations/simulation1/nullHypothesisSection.jsx

Lines changed: 13 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -4,23 +4,15 @@ import PropTypes from 'prop-types';
44

55

66
export const NullHypothesisSection = ({
7-
slope, stderror, tvalue, hypothesizedSlope,
8-
startQuiz, plotType, slopes, stderrs, tvalue3d, startQuiz2,
9-
setHypothesizedSlope, selectedAltHypothesis
7+
slope, stderror, tvalue, startQuiz, plotType, slopes, stderrs,
8+
tvalue3d, startQuiz2
109
}) => {
1110

12-
const handleNullHypothesis = (e) => {
13-
setHypothesizedSlope(parseFloat(e.target.value));
14-
};
15-
1611
useEffect(() => {
1712
document.getElementById('null-hypothesis')
1813
.scrollIntoView({ behavior: 'smooth' });
1914

20-
if (plotType === '3d') {
21-
setHypothesizedSlope(0);
22-
}
23-
}, [plotType, setHypothesizedSlope]);
15+
}, [plotType]);
2416

2517
const tEquation =
2618
't = \\cfrac{\\hat{\\beta}_1 - \\beta_1}{SE(\\hat{\\beta_1})}';
@@ -50,33 +42,19 @@ export const NullHypothesisSection = ({
5042
className="katex-inline" /> and observe the
5143
outcome of the test statistic
5244
<Katex tex={'t'} className="katex-inline" />.</p>
53-
<p><em>For your first try, set <Katex tex={
54-
'{\\beta_1}=0'} className="katex-inline" />.</em>
55-
</p>
5645
<div className="sub-content">
57-
<div className="d-flex">
58-
<label
59-
className="me-2 form-label
60-
align-self-center">
61-
<Katex tex={
62-
'{\\Eta_0} : {\\beta_1} ='
63-
} />
64-
</label>
65-
<input size="10"
66-
name="nullHypothesis"
67-
className="form-control short-input"
68-
type="number" min="-5" max="5"
69-
disabled={selectedAltHypothesis}
70-
value={hypothesizedSlope}
71-
onChange={handleNullHypothesis} />
46+
<div className="katex-block mt-3">
47+
<Katex tex={
48+
'{\\Eta_0} : {\\beta_1} = 0'
49+
} />
7250
</div>
7351
<div className="katex-block mt-3">
7452
<Katex tex={tEquation} />
7553
</div>
7654
<div className="katex-block mt-3">
7755
<Katex tex={
7856
// eslint-disable-next-line max-len
79-
`t = \\cfrac{${slope.toFixed(3)} - ${hypothesizedSlope}}{${stderror.toFixed(3)}} = ${tvalue}`
57+
`t = \\cfrac{${slope.toFixed(3)} - 0}{${stderror.toFixed(3)}} = ${tvalue}`
8058
} />
8159
</div>
8260
</div>
@@ -97,28 +75,18 @@ export const NullHypothesisSection = ({
9775
<Katex tex={'t'} className="katex-inline" />.
9876
</p>
9977
<div className="sub-content">
100-
<div className="d-flex">
101-
<label
102-
className="me-2 form-label
103-
align-self-center">
104-
<Katex tex={
105-
'{\\Eta_0} : {\\beta_1} ='
106-
} />
107-
</label>
108-
<input size="10"
109-
className="form-control short-input"
110-
type="number" min="-5" max="5"
111-
disabled={startQuiz}
112-
value={hypothesizedSlope}
113-
onChange={handleNullHypothesis} />
78+
<div className="katex-block mt-3">
79+
<Katex tex={
80+
'{\\Eta_0} : {\\beta_1} = 0'
81+
} />
11482
</div>
11583
<div className="katex-block mt-3">
11684
<Katex tex={tEquation} />
11785
</div>
11886
<div className="katex-block mt-3">
11987
<Katex tex={
12088
// eslint-disable-next-line max-len
121-
`t = \\cfrac{${slopes[0].toFixed(3)} - ${hypothesizedSlope}}{${stderrs[0].toFixed(3)}} = ${tvalue3d}`
89+
`t = \\cfrac{${slopes[0].toFixed(3)} - 0}{${stderrs[0].toFixed(3)}} = ${tvalue3d}`
12290
} />
12391
</div>
12492
</div>
@@ -136,13 +104,9 @@ NullHypothesisSection.propTypes = {
136104
tvalue: PropTypes.number,
137105
tvalue3d: PropTypes.number,
138106
tEquation: PropTypes.string,
139-
hypothesizedSlope: PropTypes.number,
140-
handleNullHypothesis: PropTypes.func,
141107
startQuiz: PropTypes.bool,
142108
plotType: PropTypes.string,
143109
slopes: PropTypes.array,
144110
stderrs: PropTypes.array,
145111
startQuiz2: PropTypes.bool,
146-
setHypothesizedSlope: PropTypes.func,
147-
selectedAltHypothesis: PropTypes.string
148112
};

0 commit comments

Comments
 (0)