Skip to content

Commit

Permalink
Update to use rur and urb keys for doctors loc column
Browse files Browse the repository at this point in the history
  • Loading branch information
ivanistheone committed Mar 29, 2024
1 parent 689b1e8 commit 16472d7
Show file tree
Hide file tree
Showing 7 changed files with 153 additions and 224 deletions.
20 changes: 10 additions & 10 deletions exercises/exercises_31_estimtors.ipynb
Expand Up @@ -229,11 +229,11 @@
"### Exercise 3.3\n",
"\n",
"Compute the difference between the means of the sleep `score` s \n",
"for the doctors working in `rural` locations and `urban` locations\n",
"for the doctors working in `rur`al locations and `urb`an locations\n",
"in the doctors dataset `datasets/doctors.csv` .\n",
"\n",
"Hint: Use the code `doctors[doctors[\"location\"]==\"rural\"]` to select\n",
"the subset of the doctors working in a `rural` location."
"Hint: Use the code `doctors[doctors[\"loc\"]==\"rur\"]` to select\n",
"the subset of the doctors working in a rural location."
]
},
{
Expand All @@ -244,8 +244,8 @@
"outputs": [],
"source": [
"doctors = pd.read_csv(\"datasets/doctors.csv\")\n",
"scoresR = doctors[doctors[\"location\"]==\"rural\"][\"score\"]\n",
"scoresU = ... # select doctors from \"urban\" location here...\n",
"scoresR = doctors[doctors[\"loc\"]==\"rur\"][\"score\"]\n",
"scoresU = ... # select doctors from \"urb\" location here...\n",
"\n",
"# compute difference between scores"
]
Expand Down Expand Up @@ -777,8 +777,8 @@
"\n",
"Describe the uncertainty about the difference between means `dmeans(scoresR,scoresU)` ,\n",
"where `scoresR` and `scoresU` are sleep scores of the rural and urban doctors\n",
"from the doctors dataset `datasets/apples.csv` . \n",
"**a)** Find an analytical formula in terms Student's $t$ -distribution. \n",
"from the doctors dataset `datasets/doctors.csv` . \n",
"**a)** Find an analytical formula in terms Student's $t$-distribution. \n",
"**b)** Use bootstrap estimation. \n",
"**c)** Compare your answers from part a) and b) graphically."
]
Expand All @@ -802,7 +802,7 @@
],
"source": [
"doctors = pd.read_csv(\"datasets/doctors.csv\")\n",
"scoresR = doctors[doctors[\"location\"]==\"rural\"][\"score\"]\n",
"scoresR = doctors[doctors[\"loc\"]==\"rur\"][\"score\"]\n",
"scoresU = ... # select urban doctors ...\n",
"\n",
"# observed difference\n",
Expand Down Expand Up @@ -1025,7 +1025,7 @@
},
{
"cell_type": "code",
"execution_count": 40,
"execution_count": 36,
"id": "7a1f9847-c46d-4d91-81d4-f4f0b41b4828",
"metadata": {},
"outputs": [
Expand All @@ -1035,7 +1035,7 @@
"Ellipsis"
]
},
"execution_count": 40,
"execution_count": 36,
"metadata": {},
"output_type": "execute_result"
}
Expand Down
8 changes: 4 additions & 4 deletions exercises/exercises_32_confidence_intervals.ipynb
Expand Up @@ -282,8 +282,8 @@
"id": "4b35dd4e-4a8c-498e-8a14-c216b04b4367",
"metadata": {},
"source": [
"Hint: Use the code `doctors[doctors[\"location\"]==\"rural\"]` to select\n",
"the subset of the doctors working in a `rural` location."
"Hint: Use the code `doctors[doctors[\"loc\"]==\"rur\"]` to select\n",
"the subset of the doctors working in a `rur`al location."
]
},
{
Expand All @@ -294,8 +294,8 @@
"outputs": [],
"source": [
"doctors = pd.read_csv(\"datasets/doctors.csv\")\n",
"scoresR = doctors[doctors[\"location\"]==\"rural\"][\"score\"]\n",
"scoresU = doctors[doctors[\"location\"]==\"urban\"][\"score\"]\n",
"scoresR = doctors[doctors[\"loc\"]==\"rur\"][\"score\"]\n",
"scoresU = doctors[doctors[\"loc\"]==\"urb\"][\"score\"]\n",
"\n",
"# observed difference between scores\n",
"dscores = ..."
Expand Down
10 changes: 5 additions & 5 deletions exercises/exercises_35_two_sample_tests.ipynb
Expand Up @@ -111,7 +111,7 @@
{
"data": {
"text/plain": [
"2.2236048265460084"
"6.992885375494076"
]
},
"execution_count": 3,
Expand All @@ -121,8 +121,8 @@
],
"source": [
"doctors = pd.read_csv(\"../datasets/doctors.csv\")\n",
"scoresU = doctors[doctors[\"location\"]==\"urban\"][\"score\"]\n",
"scoresR = doctors[doctors[\"location\"]==\"rural\"][\"score\"]\n",
"scoresU = doctors[doctors[\"loc\"]==\"urb\"][\"score\"]\n",
"scoresR = doctors[doctors[\"loc\"]==\"rur\"][\"score\"]\n",
"\n",
"# observed difference between means\n",
"dhat = dmeans(scoresR, scoresU)\n",
Expand All @@ -138,7 +138,7 @@
{
"data": {
"text/plain": [
"0.0122"
"0.0496"
]
},
"execution_count": 4,
Expand All @@ -161,7 +161,7 @@
{
"data": {
"text/plain": [
"0.0122987701229877"
"0.05019498050194981"
]
},
"execution_count": 5,
Expand Down
80 changes: 40 additions & 40 deletions exercises/solutions/exercises_31_estimtors.ipynb

Large diffs are not rendered by default.

16 changes: 8 additions & 8 deletions exercises/solutions/exercises_32_confidence_intervals.ipynb
Expand Up @@ -299,8 +299,8 @@
"id": "4b35dd4e-4a8c-498e-8a14-c216b04b4367",
"metadata": {},
"source": [
"Hint: Use the code `doctors[doctors[\"location\"]==\"rural\"]` to select\n",
"the subset of the doctors working in a `rural` location."
"Hint: Use the code `doctors[doctors[\"loc\"]==\"rur\"]` to select\n",
"the subset of the doctors working in a rural location."
]
},
{
Expand All @@ -312,7 +312,7 @@
{
"data": {
"text/plain": [
"2.2236048265460084"
"6.992885375494076"
]
},
"execution_count": 9,
Expand All @@ -322,8 +322,8 @@
],
"source": [
"doctors = pd.read_csv(\"datasets/doctors.csv\")\n",
"scoresR = doctors[doctors[\"location\"]==\"rural\"][\"score\"]\n",
"scoresU = doctors[doctors[\"location\"]==\"urban\"][\"score\"]\n",
"scoresR = doctors[doctors[\"loc\"]==\"rur\"][\"score\"]\n",
"scoresU = doctors[doctors[\"loc\"]==\"urb\"][\"score\"]\n",
"\n",
"# observed difference between scores\n",
"dscores = dmeans(scoresR,scoresU)\n",
Expand All @@ -347,7 +347,7 @@
{
"data": {
"text/plain": [
"[0.48541688303387676, 3.96179277005814]"
"[-0.10091805996217662, 14.086688810950328]"
]
},
"execution_count": 10,
Expand Down Expand Up @@ -384,7 +384,7 @@
{
"data": {
"text/plain": [
"[0.48541688303387676, 3.96179277005814]"
"[-0.10091805996217662, 14.086688810950328]"
]
},
"execution_count": 11,
Expand Down Expand Up @@ -415,7 +415,7 @@
{
"data": {
"text/plain": [
"[0.5319758672699874, 3.9718042986425353]"
"[0.09320158102766672, 13.803270750988135]"
]
},
"execution_count": 12,
Expand Down

0 comments on commit 16472d7

Please sign in to comment.