Sample data is collected in ExamScores.csv that includes scores in the first and
ID: 3371448 • Letter: S
Question
Sample data is collected in ExamScores.csv that includes scores in the first and second exams for students in a class. The variables are called Exam1 and Exam2 respectively. The professor is interested in finding out whether the average score in the second exam is different from the average score in the first exam, treating the data as matched-pair. Which of the following Python lines can be used to perform this test?
Question options:
a)
import scipy.stats as st
import pandas as pd
scores = pd.read_csv('ExamScores.csv')
exam1_paired_score = scores[['Exam1']]
exam2_paired_score = scores[['Exam2']]
null_value = 0
alternative = 'not-equal'
print(st.ttest_rel(exam1_paired_score, exam2_paired_score, equal_var=False, null_value, alternative))
b)
import scipy.stats as st
import pandas as pd
scores = pd.read_csv('ExamScores.csv')
exam1_paired_score = scores[['Exam1']]
exam2_paired_score = scores[['Exam2']]
null_value = 0
alternative = 'not-equal'
print(st.ttest_ind(exam1_paired_score, exam2_paired_score, equal_var=False, null_value, alternative))
c)
import scipy.stats as st
import pandas as pd
scores = pd.read_csv('ExamScores.csv')
exam1_paired_score = scores[['Exam1']]
exam2_paired_score = scores[['Exam2']]
print(st.ttest_rel(exam1_paired_score, exam2_paired_score))
d)
from scipy.stats import ttest_ind_from_stats as ttest
import pandas as pd
scores = pd.read_csv('ExamScores.csv')
exam1_paired_score = scores[['Exam1']]
exam2_paired_score = scores[['Exam2']]
print(ttest(exam1_paired_score, exam2_paired_score))
a)
import scipy.stats as st
import pandas as pd
scores = pd.read_csv('ExamScores.csv')
exam1_paired_score = scores[['Exam1']]
exam2_paired_score = scores[['Exam2']]
null_value = 0
alternative = 'not-equal'
print(st.ttest_rel(exam1_paired_score, exam2_paired_score, equal_var=False, null_value, alternative))
b)
import scipy.stats as st
import pandas as pd
scores = pd.read_csv('ExamScores.csv')
exam1_paired_score = scores[['Exam1']]
exam2_paired_score = scores[['Exam2']]
null_value = 0
alternative = 'not-equal'
print(st.ttest_ind(exam1_paired_score, exam2_paired_score, equal_var=False, null_value, alternative))
c)
import scipy.stats as st
import pandas as pd
scores = pd.read_csv('ExamScores.csv')
exam1_paired_score = scores[['Exam1']]
exam2_paired_score = scores[['Exam2']]
print(st.ttest_rel(exam1_paired_score, exam2_paired_score))
d)
from scipy.stats import ttest_ind_from_stats as ttest
import pandas as pd
scores = pd.read_csv('ExamScores.csv')
exam1_paired_score = scores[['Exam1']]
exam2_paired_score = scores[['Exam2']]
print(ttest(exam1_paired_score, exam2_paired_score))
Explanation / Answer
Option c) is correct
Explanation:
The t test for matched pair is performed by the code
st.ttest_rel(exam1_paired_score, exam2_paired_score)
Option a) is incorrect
Explanation: There is an error in code
st.ttest_rel(exam1_paired_score, exam2_paired_score, equal_var=False, null_value, alternative)
Here the arguments are incorrect for matched pair t test, the correct argument is
st.ttest_rel(exam1_paired_score, exam2_paired_score)
Option b) is incorrect
Explanation:
Here the code
print(st.ttest_ind(exam1_paired_score, exam2_paired_score, equal_var=False, null_value, alternative)
returns the independent samples t-test result
Option d) is incorrect
Explanation:
Here the code
from scipy.stats import ttest_ind_from_stats as ttest
importing the t-test for independent samples t test.
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.