<SYSTEM_TASK:>
Given the following text description, write Python code to implement the functionality described below step by step
<END_TASK>
<USER_TASK:>
Description:
 Google form analysis tests
Purpose
Step1:  Sorted total answers to questions
<a id=sortedtotalanswers />
Step2:  Cross-samples t-tests
<a id=crossttests />
Purpose
Step3:  Conclusion
<ASSISTANT_TASK:>
Python Code:
%run "../Functions/1. Google form analysis.ipynb"
Explanation: Google form analysis tests
Purpose: determine in what extent the current data can accurately describe correlations, underlying factors on the score.
Especially concerning the 'before' groups: are there underlying groups explaining the discrepancies in score? Are those groups tied to certain questions?
Table of Contents
Sorted total answers to questions
Cross-samples t-tests
biologists vs non-biologists
biologists vs non-biologists before
<br>
<br>
<br>
<br>
End of explanation
binarized = getAllBinarized()
answersCount = len(binarized.index)
totalScorePerQuestion = pd.DataFrame(data=np.dot(np.ones(answersCount),binarized),index=binarized.columns,columns=['score'])
totalScorePerQuestion['perc'] = totalScorePerQuestion['score'] * 100 / answersCount
display(totalScorePerQuestion.sort_values(by = 'score'))
Explanation: Sorted total answers to questions
<a id=sortedtotalanswers />
End of explanation
biologists = getSurveysOfBiologists(gform)
nonBiologists = gform.drop(biologists.index)
biologistsScores = biologists.apply(getGFormRowScore, axis=1)
nonBiologistsScores = nonBiologists.apply(getGFormRowScore, axis=1)
#print(len(gform), len(biologists), len(nonBiologists))
#print(len(gform), len(biologistsScores), len(nonBiologistsScores))
#print(type(biologistsScores), len(biologistsScores),\
#type(nonBiologistsScores), len(nonBiologistsScores))
ttest = ttest_ind(biologistsScores, nonBiologistsScores)
ttest
biologistsScores.values
np.std(biologistsScores)
np.std(nonBiologistsScores)
Explanation: Cross-samples t-tests
<a id=crossttests />
Purpose: find out whether a question can be used to discriminate different groups.
biologists vs non-biologists
<a id=biologistsvsnonbiologists />
End of explanation
gfBefores = getGFormBefores(gform)
biologistsBefores = getSurveysOfBiologists(gfBefores, hardPolicy = False)
nonBiologistsBefores = gfBefores.drop(biologistsBefores.index)
biologistsBeforesScores = biologistsBefores.apply(getGFormRowScore, axis=1)
nonBiologistsBeforesScores = nonBiologistsBefores.apply(getGFormRowScore, axis=1)
#print(len(gfBefores), len(biologistsBefores), len(nonBiologistsBefores))
#print(len(gfBefores), len(biologistsBeforesScores), len(nonBiologistsBeforesScores))
#print(type(biologistsScores), len(biologistsScores),\
#type(nonBiologistsScores), len(nonBiologistsScores))
ttest = ttest_ind(biologistsBeforesScores, nonBiologistsBeforesScores)
ttest
np.std(biologistsBeforesScores)
nonBiologistsBeforesScores
np.std(nonBiologistsBeforesScores)
Explanation: Conclusion: the two groups have distinct scores.
biologists vs non-biologists before
<a id=biologistsvsnonbiologistsbefore />
End of explanation
<END_TASK>