aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Anshul Gupta <ansg191@anshulg.com> 2024-02-23 23:48:59 -0800
committerGravatar Anshul Gupta <ansg191@anshulg.com> 2024-02-23 23:48:59 -0800
commit0fb4cfef6b86d82661a38edf9a9225171098f7b1 (patch)
tree2f5f6e6cb5f3b38b5659b4e099b78cd48cdf66e0
parent49d16898b96f5aaa5ca235ea17073211b021d66d (diff)
downloadCS105MiniProject-0fb4cfef6b86d82661a38edf9a9225171098f7b1.tar.gz
CS105MiniProject-0fb4cfef6b86d82661a38edf9a9225171098f7b1.tar.zst
CS105MiniProject-0fb4cfef6b86d82661a38edf9a9225171098f7b1.zip
Fixes
-rw-r--r--CS105MiniProject.ipynb418
-rw-r--r--CS105MiniProject_latex.pdfbin325467 -> 325465 bytes
-rw-r--r--CS105MiniProject_web.pdfbin3887561 -> 3887564 bytes
3 files changed, 209 insertions, 209 deletions
diff --git a/CS105MiniProject.ipynb b/CS105MiniProject.ipynb
index 4d2fb03..21fd62a 100644
--- a/CS105MiniProject.ipynb
+++ b/CS105MiniProject.ipynb
@@ -15,12 +15,16 @@
"By:\n",
"- Anshul Gupta <agupt109@ucr.edu>\n",
"- Ali Naqvi <anaqv007@ucr.edu>\n",
- "- Alex Zhang <zzhan309@ucr.edu>\n",
+ "- Alex Zhang <azhan061@ucr.edu>\n",
"- Nathan Lee <nlee097@ucr.edu>"
]
},
{
"cell_type": "markdown",
+ "id": "bef879a82ebab4fc",
+ "metadata": {
+ "collapsed": false
+ },
"source": [
"# Pre-Data Questions & Analysis\n",
"\n",
@@ -37,11 +41,7 @@
"- Hypothesis 1: There will be a correlation between whether people live with family, friends, or neither and whether or not they work.\n",
"- Hypothesis 2: Students who live on-campus are more likely to have roommates of the same major.\n",
"- Hypothesis 3: People who live with more people will have a higher GPA on average.\n"
- ],
- "metadata": {
- "collapsed": false
- },
- "id": "bef879a82ebab4fc"
+ ]
},
{
"cell_type": "markdown",
@@ -60,8 +60,8 @@
"metadata": {
"collapsed": false,
"ExecuteTime": {
- "end_time": "2024-02-24T07:34:13.582059Z",
- "start_time": "2024-02-24T07:34:13.557166Z"
+ "end_time": "2024-02-24T07:48:50.088633Z",
+ "start_time": "2024-02-24T07:48:50.060420Z"
}
},
"outputs": [
@@ -108,8 +108,8 @@
"metadata": {
"collapsed": false,
"ExecuteTime": {
- "end_time": "2024-02-24T07:34:13.601138Z",
- "start_time": "2024-02-24T07:34:13.582856Z"
+ "end_time": "2024-02-24T07:48:50.130790Z",
+ "start_time": "2024-02-24T07:48:50.115084Z"
}
},
"outputs": [
@@ -204,8 +204,8 @@
"metadata": {
"collapsed": false,
"ExecuteTime": {
- "end_time": "2024-02-24T07:34:13.611830Z",
- "start_time": "2024-02-24T07:34:13.602429Z"
+ "end_time": "2024-02-24T07:48:50.138980Z",
+ "start_time": "2024-02-24T07:48:50.131690Z"
}
},
"outputs": [
@@ -234,8 +234,8 @@
"metadata": {
"collapsed": false,
"ExecuteTime": {
- "end_time": "2024-02-24T07:34:13.620798Z",
- "start_time": "2024-02-24T07:34:13.612681Z"
+ "end_time": "2024-02-24T07:48:50.158653Z",
+ "start_time": "2024-02-24T07:48:50.139572Z"
}
},
"outputs": [
@@ -270,8 +270,8 @@
"metadata": {
"collapsed": false,
"ExecuteTime": {
- "end_time": "2024-02-24T07:34:13.744364Z",
- "start_time": "2024-02-24T07:34:13.621610Z"
+ "end_time": "2024-02-24T07:48:50.291337Z",
+ "start_time": "2024-02-24T07:48:50.166762Z"
}
},
"outputs": [
@@ -297,16 +297,25 @@
},
{
"cell_type": "markdown",
- "source": [
- "The majority of student respondents (70.4%) do **not** work while attending school."
- ],
+ "id": "5dbc734405a3858d",
"metadata": {
"collapsed": false
},
- "id": "5dbc734405a3858d"
+ "source": [
+ "The majority of student respondents (70.4%) do **not** work while attending school."
+ ]
},
{
"cell_type": "code",
+ "execution_count": 6,
+ "id": "c533e52f7d64a4df",
+ "metadata": {
+ "collapsed": false,
+ "ExecuteTime": {
+ "end_time": "2024-02-24T07:48:50.531268Z",
+ "start_time": "2024-02-24T07:48:50.293807Z"
+ }
+ },
"outputs": [
{
"data": {
@@ -337,19 +346,14 @@
"plt.xlabel('Do you currently live in a house, apartment, or dorm?')\n",
"_ = plt.ylabel('Do you currently work?')\n",
"df_2dhist"
- ],
- "metadata": {
- "collapsed": false,
- "ExecuteTime": {
- "end_time": "2024-02-24T07:34:13.935970Z",
- "start_time": "2024-02-24T07:34:13.748569Z"
- }
- },
- "id": "c533e52f7d64a4df",
- "execution_count": 6
+ ]
},
{
"cell_type": "markdown",
+ "id": "6294dcc03fa9f516",
+ "metadata": {
+ "collapsed": false
+ },
"source": [
"For both working & non-working participants, the proportion who live in an apartment are equivalent (50%).\n",
"\n",
@@ -357,14 +361,19 @@
"This 7% drop is matched in participants who live a house, with 44% of working participants living in a house compared to 36% of non-working participants.\n",
"\n",
"This indicates that working participants tend to live off-campus and in living situations that have a higher cost of living."
- ],
- "metadata": {
- "collapsed": false
- },
- "id": "6294dcc03fa9f516"
+ ]
},
{
"cell_type": "code",
+ "execution_count": 7,
+ "id": "450665f2272bb3a2",
+ "metadata": {
+ "collapsed": false,
+ "ExecuteTime": {
+ "end_time": "2024-02-24T07:48:50.669888Z",
+ "start_time": "2024-02-24T07:48:50.533682Z"
+ }
+ },
"outputs": [
{
"data": {
@@ -380,29 +389,29 @@
" color=sns.palettes.mpl_palette(\n",
" 'Dark2'))\n",
"plt.gca().spines[['top', 'right', ]].set_visible(False)"
- ],
- "metadata": {
- "collapsed": false,
- "ExecuteTime": {
- "end_time": "2024-02-24T07:34:14.077650Z",
- "start_time": "2024-02-24T07:34:13.936947Z"
- }
- },
- "id": "450665f2272bb3a2",
- "execution_count": 7
+ ]
},
{
"cell_type": "markdown",
- "source": [
- "Most participants live in either an Apartment or a House. This would indicate that most students either live off-campus or on-campus apartments."
- ],
+ "id": "4d64d891924f201e",
"metadata": {
"collapsed": false
},
- "id": "4d64d891924f201e"
+ "source": [
+ "Most participants live in either an Apartment or a House. This would indicate that most students either live off-campus or on-campus apartments."
+ ]
},
{
"cell_type": "code",
+ "execution_count": 8,
+ "id": "1a704a4702ea3f9c",
+ "metadata": {
+ "collapsed": false,
+ "ExecuteTime": {
+ "end_time": "2024-02-24T07:48:50.808356Z",
+ "start_time": "2024-02-24T07:48:50.672631Z"
+ }
+ },
"outputs": [
{
"name": "stdout",
@@ -425,19 +434,14 @@
" index='How many hours do you work per week on average?', aggfunc='mean')\n",
"_ = dataTable1.plot(kind='bar')\n",
"print(\"Total Average GPA: \", df['What was your GPA your very first quarter at UCR?'].mean())"
- ],
- "metadata": {
- "collapsed": false,
- "ExecuteTime": {
- "end_time": "2024-02-24T07:34:14.262091Z",
- "start_time": "2024-02-24T07:34:14.080165Z"
- }
- },
- "id": "1a704a4702ea3f9c",
- "execution_count": 8
+ ]
},
{
"cell_type": "markdown",
+ "id": "cb1fd8e56d403466",
+ "metadata": {
+ "collapsed": false
+ },
"source": [
"The average GPA seems to be independent in respect to working hours per week.\n",
"Most students who work less than 20 hours have an equivalent average GPA to the total average GPA of all participants (3.65).\n",
@@ -446,14 +450,19 @@
"\n",
"This would indicate that most students seem to be able to balance work with school. However, it would also indicate that\n",
"students who work full-time jobs may struggle slightly in school."
- ],
- "metadata": {
- "collapsed": false
- },
- "id": "cb1fd8e56d403466"
+ ]
},
{
"cell_type": "code",
+ "execution_count": 9,
+ "id": "ae23070caa8a3c88",
+ "metadata": {
+ "collapsed": false,
+ "ExecuteTime": {
+ "end_time": "2024-02-24T07:48:51.310289Z",
+ "start_time": "2024-02-24T07:48:50.810370Z"
+ }
+ },
"outputs": [
{
"data": {
@@ -471,32 +480,32 @@
" df['What are your career plans right after graduation?'],\n",
" normalize='index'\n",
").plot(kind=\"bar\", stacked=True, rot=0, figsize=(30, 15))"
- ],
- "metadata": {
- "collapsed": false,
- "ExecuteTime": {
- "end_time": "2024-02-24T07:34:14.822547Z",
- "start_time": "2024-02-24T07:34:14.266056Z"
- }
- },
- "id": "ae23070caa8a3c88",
- "execution_count": 9
+ ]
},
{
"cell_type": "markdown",
+ "id": "5f7faaa1acde66ef",
+ "metadata": {
+ "collapsed": false
+ },
"source": [
"Most students across all groups are looking to \"get into the job industry\".\n",
"Across all groups, the proportions of \"Attending Grad School\" and \"Get into the job industry\" are similar, except for students who have extended family in their career.\n",
"They are more unsure about their future compared to other groups.\n",
"Also, students with no family in their field are more diversified in their career plans."
- ],
- "metadata": {
- "collapsed": false
- },
- "id": "5f7faaa1acde66ef"
+ ]
},
{
"cell_type": "code",
+ "execution_count": 10,
+ "id": "464b4dec962ea0ae",
+ "metadata": {
+ "collapsed": false,
+ "ExecuteTime": {
+ "end_time": "2024-02-24T07:48:51.468113Z",
+ "start_time": "2024-02-24T07:48:51.311047Z"
+ }
+ },
"outputs": [
{
"data": {
@@ -519,32 +528,32 @@
" df['Do you currently work?'],\n",
" normalize='index'\n",
").plot(kind='bar', stacked=True, ax=axes[1])"
- ],
- "metadata": {
- "collapsed": false,
- "ExecuteTime": {
- "end_time": "2024-02-24T07:34:15.002736Z",
- "start_time": "2024-02-24T07:34:14.823782Z"
- }
- },
- "id": "464b4dec962ea0ae",
- "execution_count": 10
+ ]
},
{
"cell_type": "markdown",
+ "id": "d041734386169b98",
+ "metadata": {
+ "collapsed": false
+ },
"source": [
"The class standing most likely to work are graduate students, where 100% of participants work. \n",
"The freshman class is the least likely to work, where 92% of participants do not work.\n",
"\n",
"For Sophomore, Junior, and Senior participants, all 3 groups have similar proportions working with 30% of participants working. "
- ],
- "metadata": {
- "collapsed": false
- },
- "id": "d041734386169b98"
+ ]
},
{
"cell_type": "code",
+ "execution_count": 11,
+ "id": "101f55892c052d46",
+ "metadata": {
+ "collapsed": false,
+ "ExecuteTime": {
+ "end_time": "2024-02-24T07:48:51.642467Z",
+ "start_time": "2024-02-24T07:48:51.470798Z"
+ }
+ },
"outputs": [
{
"data": {
@@ -568,33 +577,33 @@
" w_df['Do you work in a department related to your major?'],\n",
" normalize='index',\n",
").plot(kind='bar', stacked=True, ax=axes[1])"
- ],
- "metadata": {
- "collapsed": false,
- "ExecuteTime": {
- "end_time": "2024-02-24T07:34:15.166551Z",
- "start_time": "2024-02-24T07:34:15.003539Z"
- }
- },
- "id": "101f55892c052d46",
- "execution_count": 11
+ ]
},
{
"cell_type": "markdown",
+ "id": "a77e6367ee785afb",
+ "metadata": {
+ "collapsed": false
+ },
"source": [
"Of the students who responded \"yes\" to currently working, the above graphs show the proportions of participants who work in a department related to their major.\n",
"Most students do not work in a department related to their major, indicating that they are working for money rather than job experience. \n",
"his holds true for all groups except for Graduate students, who all work in a department of their major.\n",
"\n",
"Interestingly, Juniors have a higher rate of working in their major, perhaps indicating internships or students seeking to gain major-related work experience."
- ],
- "metadata": {
- "collapsed": false
- },
- "id": "a77e6367ee785afb"
+ ]
},
{
"cell_type": "code",
+ "execution_count": 12,
+ "id": "350d4fef50f55e38",
+ "metadata": {
+ "collapsed": false,
+ "ExecuteTime": {
+ "end_time": "2024-02-24T07:48:51.799432Z",
+ "start_time": "2024-02-24T07:48:51.643494Z"
+ }
+ },
"outputs": [
{
"data": {
@@ -607,40 +616,35 @@
],
"source": [
"_ = sns.violinplot(x=df[\"How many internship/job applications have you sent out so far?\"])"
- ],
- "metadata": {
- "collapsed": false,
- "ExecuteTime": {
- "end_time": "2024-02-24T07:34:15.356893Z",
- "start_time": "2024-02-24T07:34:15.167983Z"
- }
- },
- "id": "350d4fef50f55e38",
- "execution_count": 12
+ ]
},
{
"cell_type": "markdown",
- "source": [
- "From the violin plot, we can see that students send out many job applications Some students have sent out many (up to 1000) applications.\n",
- "The distribution is skewed right with many outliers who have sent out significantly more applications than most students."
- ],
+ "id": "a3f2976fd30ca299",
"metadata": {
"collapsed": false
},
- "id": "a3f2976fd30ca299"
+ "source": [
+ "From the violin plot, we can see that students send out many job applications Some students have sent out many (up to 1000) applications.\n",
+ "The distribution is skewed right with many outliers who have sent out significantly more applications than most students."
+ ]
},
{
"cell_type": "markdown",
- "source": [
- "## Hypotheses"
- ],
+ "id": "f573ee142b931496",
"metadata": {
"collapsed": false
},
- "id": "f573ee142b931496"
+ "source": [
+ "## Hypotheses"
+ ]
},
{
"cell_type": "markdown",
+ "id": "af9e65fe95ad565e",
+ "metadata": {
+ "collapsed": false
+ },
"source": [
"# Hypothesis 1: There will be a correlation between whether people live with family, friends, or neither and whether or not they work\n",
"\n",
@@ -648,14 +652,19 @@
"\n",
"Significance value: 0.1\n",
"Degrees of freedom: 3"
- ],
- "metadata": {
- "collapsed": false
- },
- "id": "af9e65fe95ad565e"
+ ]
},
{
"cell_type": "code",
+ "execution_count": 13,
+ "id": "48b809cbd77a656f",
+ "metadata": {
+ "collapsed": false,
+ "ExecuteTime": {
+ "end_time": "2024-02-24T07:48:51.822988Z",
+ "start_time": "2024-02-24T07:48:51.800956Z"
+ }
+ },
"outputs": [
{
"data": {
@@ -670,19 +679,19 @@
"source": [
"hyp3_major_table = pd.crosstab(df.iloc[:, 3], df.iloc[:, 8], margins=True, margins_name='Total')\n",
"hyp3_major_table"
- ],
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 14,
+ "id": "b82779602aa7b791",
"metadata": {
"collapsed": false,
"ExecuteTime": {
- "end_time": "2024-02-24T07:34:15.374530Z",
- "start_time": "2024-02-24T07:34:15.358439Z"
+ "end_time": "2024-02-24T07:48:51.831186Z",
+ "start_time": "2024-02-24T07:48:51.824301Z"
}
},
- "id": "48b809cbd77a656f",
- "execution_count": 13
- },
- {
- "cell_type": "code",
"outputs": [
{
"name": "stdout",
@@ -706,32 +715,27 @@
" chi_squared += ((hyp3_major_table.iloc[i, j] - expected_frequency) ** 2) / expected_frequency\n",
"\n",
"print(\"Chi-squared value:\", chi_squared)"
- ],
- "metadata": {
- "collapsed": false,
- "ExecuteTime": {
- "end_time": "2024-02-24T07:34:15.380613Z",
- "start_time": "2024-02-24T07:34:15.376125Z"
- }
- },
- "id": "b82779602aa7b791",
- "execution_count": 14
+ ]
},
{
"cell_type": "markdown",
+ "id": "543e4daba6344237",
+ "metadata": {
+ "collapsed": false
+ },
"source": [
"With a significance value of 0.1 and 3 degrees of freedom, chi-squared must be greater than 6.25.\n",
"Since chi-squared of `4.61 < 6.25`, we accept the null hypothesis:\n",
"\n",
"There is no relationship between people who live with family, friends, or neither and whether or not they work."
- ],
- "metadata": {
- "collapsed": false
- },
- "id": "543e4daba6344237"
+ ]
},
{
"cell_type": "markdown",
+ "id": "dcc6d91b3e660c2e",
+ "metadata": {
+ "collapsed": false
+ },
"source": [
"### Hypothesis 2: Students who live on-campus are more likely to have roommates of the same major.\n",
"\n",
@@ -739,14 +743,19 @@
"\n",
"Significance value: 0.1\n",
"Degrees of Freedom: 2"
- ],
- "metadata": {
- "collapsed": false
- },
- "id": "dcc6d91b3e660c2e"
+ ]
},
{
"cell_type": "code",
+ "execution_count": 15,
+ "id": "24d1f01fdd4ca1d6",
+ "metadata": {
+ "collapsed": false,
+ "ExecuteTime": {
+ "end_time": "2024-02-24T07:48:51.846910Z",
+ "start_time": "2024-02-24T07:48:51.832612Z"
+ }
+ },
"outputs": [
{
"data": {
@@ -761,19 +770,19 @@
"source": [
"roommates_major_table = pd.crosstab(df.iloc[:, 4], df.iloc[:, 11], margins=True, margins_name='Total')\n",
"roommates_major_table"
- ],
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 16,
+ "id": "fd3e73d9f461afd1",
"metadata": {
"collapsed": false,
"ExecuteTime": {
- "end_time": "2024-02-24T07:34:15.418868Z",
- "start_time": "2024-02-24T07:34:15.382411Z"
+ "end_time": "2024-02-24T07:48:51.851376Z",
+ "start_time": "2024-02-24T07:48:51.848014Z"
}
},
- "id": "24d1f01fdd4ca1d6",
- "execution_count": 15
- },
- {
- "cell_type": "code",
"outputs": [
{
"name": "stdout",
@@ -797,42 +806,42 @@
" chi_squared += ((roommates_major_table.iloc[i, j] - expected_frequency) ** 2) / expected_frequency\n",
"\n",
"print(\"Chi-squared value:\", chi_squared)"
- ],
- "metadata": {
- "collapsed": false,
- "ExecuteTime": {
- "end_time": "2024-02-24T07:34:15.431282Z",
- "start_time": "2024-02-24T07:34:15.421577Z"
- }
- },
- "id": "fd3e73d9f461afd1",
- "execution_count": 16
+ ]
},
{
"cell_type": "markdown",
+ "id": "32eff09a99bfb3c7",
+ "metadata": {
+ "collapsed": false
+ },
"source": [
"With a significance value of 0.1 and 2 degrees of freedom, chi-squared must be greater than 4.61.\n",
"Since chi-squared of `4.18 < 4.61`, we accept the null hypothesis:\n",
"\n",
"There is no relationship between students who live on-campus and students who have roommates of the same major."
- ],
- "metadata": {
- "collapsed": false
- },
- "id": "32eff09a99bfb3c7"
+ ]
},
{
"cell_type": "markdown",
- "source": [
- "### Hypothesis 3: People who live with more people will have a higher GPA on average."
- ],
+ "id": "56a4b6a6c1e05d81",
"metadata": {
"collapsed": false
},
- "id": "56a4b6a6c1e05d81"
+ "source": [
+ "### Hypothesis 3: People who live with more people will have a higher GPA on average."
+ ]
},
{
"cell_type": "code",
+ "execution_count": 17,
+ "id": "b513f8e8241e86e5",
+ "metadata": {
+ "collapsed": false,
+ "ExecuteTime": {
+ "end_time": "2024-02-24T07:48:51.908631Z",
+ "start_time": "2024-02-24T07:48:51.853321Z"
+ }
+ },
"outputs": [
{
"name": "stdout",
@@ -865,43 +874,34 @@
"# Calculate Pearson correlation coefficient\n",
"pearson_coefficient = (numerator / ((denom_x * denom_y) ** 0.5))\n",
"print(\"Pearson Correlation Coefficient:\", pearson_coefficient)"
- ],
- "metadata": {
- "collapsed": false,
- "ExecuteTime": {
- "end_time": "2024-02-24T07:34:15.480558Z",
- "start_time": "2024-02-24T07:34:15.434687Z"
- }
- },
- "id": "b513f8e8241e86e5",
- "execution_count": 17
+ ]
},
{
"cell_type": "markdown",
+ "id": "79b83b5ec3c1f9c5",
+ "metadata": {
+ "collapsed": false
+ },
"source": [
"With a Pearson Correlation Coefficient of -0.2, there is a slight negative correlation between household size and average GPA.\n",
"Students who live alone or with fewer people perform slightly better than those with more roommates.\n",
"\n",
"This goes against our hypothesis that people living with more people will have a higher GPA."
- ],
- "metadata": {
- "collapsed": false
- },
- "id": "79b83b5ec3c1f9c5"
+ ]
},
{
"cell_type": "markdown",
+ "id": "eb743c217058807f",
+ "metadata": {
+ "collapsed": false
+ },
"source": [
"# Conclusion\n",
"\n",
"In wanting to figure out in general how various aspects of a student’s home environment go on to affect their employment and school performance, we performed 3 different tests: Comparing what kind of people participants lived with and whether or not they work, students who work on campus and their roommates majors, and the number of people participants lived with and the participant’s GPA. However, using chi-squared tests and pearson correlation, we discovered that none of our hypotheses had any correlation with it. But from here we can delve deeper into our hypothesis, for example why did working not affect student’s GPA’s in the first quarter? What are other potential factors as to why that was the case? In addition, Freshmen were found to not work at major related jobs, whereas juniors were the most likely to work at a major related job.\n",
"\n",
"Even though none of our hypotheses were proven to be true, we still learned a lot about the data given to us and we can use it to further more questions and assumptions later down the line.\n"
- ],
- "metadata": {
- "collapsed": false
- },
- "id": "eb743c217058807f"
+ ]
}
],
"metadata": {
@@ -923,7 +923,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
- "version": "3.11.5"
+ "version": "3.11.8"
}
},
"nbformat": 4,
diff --git a/CS105MiniProject_latex.pdf b/CS105MiniProject_latex.pdf
index e57515c..246f44b 100644
--- a/CS105MiniProject_latex.pdf
+++ b/CS105MiniProject_latex.pdf
Binary files differ
diff --git a/CS105MiniProject_web.pdf b/CS105MiniProject_web.pdf
index f552b8a..6df51a2 100644
--- a/CS105MiniProject_web.pdf
+++ b/CS105MiniProject_web.pdf
Binary files differ