What is the purpose of a t-test in hypothesis testing?
A t-test checks if the average (mean) of a group is different from a known value or another group's mean. It helps decide if the difference is real or just by chance.
Click to reveal answer
beginner
What does the chi-square test (chi2test) check in data?
The chi-square test checks if two categorical variables are related or independent by comparing observed counts with expected counts.
Click to reveal answer
beginner
In MATLAB, which function is used to perform a one-sample t-test?
The function ttest is used for a one-sample t-test in MATLAB. You give it your data and the mean to compare against.
Click to reveal answer
beginner
What is the null hypothesis in a chi-square test?
The null hypothesis says that the two categorical variables are independent, meaning no association between them.
Click to reveal answer
beginner
What does a p-value tell you in hypothesis testing?
A p-value tells how likely it is to see your data if the null hypothesis is true. A small p-value means the data is unlikely by chance, so you may reject the null.
Click to reveal answer
Which MATLAB function performs a t-test?
Acorrcoef
Bchi2test
Canova
Dttest
✗ Incorrect
The ttest function is used in MATLAB to perform t-tests.
What does the chi-square test compare?
AObserved and expected frequencies
BCorrelation between variables
CMeans of two groups
DVariance of a sample
✗ Incorrect
The chi-square test compares observed counts with expected counts to test independence.
If the p-value is less than 0.05, what should you do?
AIncrease sample size
BAccept the null hypothesis
CReject the null hypothesis
DIgnore the result
✗ Incorrect
A p-value below 0.05 usually means rejecting the null hypothesis.
Which test is best for checking if two categorical variables are related?
At-test
Bchi-square test
Clinear regression
DANOVA
✗ Incorrect
The chi-square test is used for relationships between categorical variables.
What is the null hypothesis in a t-test?
AMeans are equal
BMeans are different
CVariables are independent
DVariables are correlated
✗ Incorrect
The null hypothesis in a t-test states that the means are equal.
Explain how to perform a one-sample t-test in MATLAB and interpret the results.
Think about the data you compare and what the p-value means.
You got /5 concepts.
Describe the steps to conduct a chi-square test in MATLAB and what conclusions you can draw.
Focus on comparing counts and what independence means.
You got /5 concepts.
Practice
(1/5)
1. What does the MATLAB function ttest primarily test?
easy
A. Whether the data follows a normal distribution
B. Whether two samples have the same variance
C. Whether the mean of a sample differs from a specified value
D. Whether the counts in categories match expected counts
Solution
Step 1: Understand the purpose of ttest
The ttest function in MATLAB tests if the mean of a sample is equal to a given value.
Step 2: Compare with other tests
chi2gof tests counts, not means; variance tests are different; normality tests are separate.
Final Answer:
Whether the mean of a sample differs from a specified value -> Option C
B. The vectors observed and expected must be the same length
C. chi2gof cannot be used with expected counts
D. The observed data should be a vector of counts, but chi2gof expects raw data samples
Solution
Step 1: Understand chi2gof input requirements
chi2gof expects raw sample data, not observed counts directly.
Step 2: Check usage of 'ExpectedCounts'
The 'ExpectedCounts' parameter is valid but only used with raw data; providing counts directly leads to incorrect results.
Final Answer:
The observed data should be a vector of counts, but chi2gof expects raw data samples -> Option D
Quick Check:
chi2gof needs raw data, not counts [OK]
Hint: chi2gof needs raw data, not counts vector [OK]
Common Mistakes:
Passing counts instead of raw data
Misspelling parameter names
Assuming chi2gof accepts counts directly
5. You have observed counts obs = [40, 35, 25] and expected proportions expProp = [0.3, 0.4, 0.3]. How do you correctly perform a chi-square goodness-of-fit test in MATLAB to check if observed counts fit expected proportions?
hard
A. Convert expected proportions to expected counts, then use chi2gof with raw data generated from counts
B. Directly use chi2gof(obs, 'Expected', expProp)
C. Use ttest(obs, expProp) to compare counts and proportions
D. Use chi2gof with observed counts and expected counts vectors
Solution
Step 1: Calculate expected counts from proportions
Multiply total observed count by expected proportions: total = 40+35+25=100; expected counts = 100 * expProp = [30, 40, 30].
Step 2: Generate raw data samples for chi2gof
Since chi2gof needs raw data, create a vector with repeated category labels matching observed counts.
Step 3: Perform chi-square test
Use chi2gof with raw data and specify expected counts via 'ExpectedCounts' parameter.
Final Answer:
Convert expected proportions to expected counts, then use chi2gof with raw data generated from counts -> Option A
Quick Check:
chi2gof needs raw data and expected counts [OK]
Hint: Convert proportions to counts, create raw data for chi2gof [OK]
Common Mistakes:
Passing proportions directly as expected counts
Using ttest for count data
Not converting counts to raw data samples
Recommended
Ready to prove it?
Pass the test and this pattern moves unknownstrongwhile earning +1 Grip toward your certificate.