Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add summary of review of statistics. #384

Merged
merged 1 commit into from
Nov 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 25 additions & 0 deletions _posts/2024-11-22-review-of-statistics.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
---
layout: post
title: "Review of Statistics"
tags:
- statistics
---

In class today we reviewed statistics.

You can see a recording of the class [here](https://cardiff.cloud.panopto.eu/Panopto/Pages/Viewer.aspx?id=cbac6507-2962-42ce-8336-b22b00a5781b)

This week's quiz was won again by bc.

6 usernames have won:

- bc
- Dmitry (2)
- Homelander
- Hacker
- Matt
- Michael

After the quiz I tackled the coursework like question from the handout.
You can see the notebook here:
[statistics.ipynb]({{site.baseurl}}/assets/nbs/2024-2025/statistics-review.ipynb)
217 changes: 217 additions & 0 deletions assets/nbs/2024-2025/statistics-review.ipynb
Original file line number Diff line number Diff line change
@@ -0,0 +1,217 @@
{
"cells": [
{
"cell_type": "code",
"execution_count": 1,
"id": "367e7b7a-0872-42fa-96aa-f81ccb9a2dcf",
"metadata": {},
"outputs": [],
"source": [
"import statistics as st"
]
},
{
"cell_type": "code",
"execution_count": 4,
"id": "c74231d9-2b40-42f2-a9bc-ebc733025221",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"NormalDist(mu=10.0, sigma=0.5)"
]
},
"execution_count": 4,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"distribution = st.NormalDist(mu=10, sigma=.5)\n",
"distribution"
]
},
{
"cell_type": "code",
"execution_count": 5,
"id": "8f80c49d-98cf-40c6-b3f8-6c94c01f6216",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"3.167124183311998e-05"
]
},
"execution_count": 5,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"probability_of_less_than_eight = distribution.cdf(8)\n",
"probability_of_less_than_eight"
]
},
{
"cell_type": "code",
"execution_count": 6,
"id": "b64b155b-ad76-4d47-a1e4-5658657984fd",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"10.6407757827723"
]
},
"execution_count": 6,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"distribution.inv_cdf(.9)"
]
},
{
"cell_type": "markdown",
"id": "b9773b8f-ed9b-40de-b14e-17000ff05482",
"metadata": {},
"source": [
"Question 6 from the coursework."
]
},
{
"cell_type": "code",
"execution_count": 17,
"id": "4bb67df0-8752-44c8-b2d8-a5d5d753b2bf",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"NormalDist(mu=65.0, sigma=5.0)"
]
},
"execution_count": 17,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"distribution = st.NormalDist(mu=65, sigma=5)\n",
"distribution"
]
},
{
"cell_type": "markdown",
"id": "e8832e88-c92d-4fcd-a4b2-31b4944c2f17",
"metadata": {},
"source": [
"The probability of failing (getting a score less than 40%) is given by the cdf:"
]
},
{
"cell_type": "code",
"execution_count": 18,
"id": "cbf46b9a-b324-42a6-bb6d-c956e7583f82",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"2.8665157186802404e-07"
]
},
"execution_count": 18,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"distribution.cdf(40)"
]
},
{
"cell_type": "markdown",
"id": "fad76ac8-848e-48ac-b756-c72eb78e77b7",
"metadata": {},
"source": [
"The probality of getting a first class mark is: $1-F(70)$."
]
},
{
"cell_type": "code",
"execution_count": 19,
"id": "83b8b528-d94a-46d1-9ef4-aa1c49617f74",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"0.15865525393145707"
]
},
"execution_count": 19,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"1 - distribution.cdf(70)"
]
},
{
"cell_type": "code",
"execution_count": 21,
"id": "d6901c15-b13c-4725-9ba7-3e7b9d15ab8b",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"71.407757827723"
]
},
"execution_count": 21,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"distribution.inv_cdf(1 - .10)"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "a82176dc-aab2-4fb7-8532-978ac7ad9337",
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3 (ipykernel)",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.13.0"
}
},
"nbformat": 4,
"nbformat_minor": 5
}
Loading