{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# Homework 7\n", "#### CHE 116: Numerical Methods and Statistics\n", "\n", "\n", "2/27/2020\n", "\n", "----" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "# 1. Midterm Review Question\n", "\n", "1. [8 points] Please complete the following table:\n", "\n", "\n", "| Name | Abbreviation | Mathematical Expression | input | output | \n", "|:-----|:------------:|:---------:|:-----:|-------:|\n", "| Probability Mass Function | PMF | $P(q)$ | element in sample space | probability |\n", "| ? | PDF | $p(q)$ | ? | must be integrated, outputs probability of interval |\n", "| ? | ? | $P(x < y)$ | upper bound of interval ($y)$ | ? |\n", "| ? | PPF | $y$ such that ? | probability of interval ($p$) | ? |\n", "\n", "2. [2 point] What are the inputs/outputs to a random variable?\n", "\n", "3. [2 points] If a problem statement gives you $P(X = 3 | Y = 4)$ and $P(Y = 4)$, what equation gives you $P(X = 3, Y = 4)$?\n", "\n", "4. [4 points] If you flip a coin twelve times, how many permutations are possible and how many combinations of heads/tails are possible?\n" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "# 2 Analyzing 1D Data\n", "\n", "1. [4 points] Load the sunspot.month dataset and histogram the **last** column (number of sunspots per month). Use this code snippet: `sunspot_data = pydataset.data('sunspot.month').values`. If you get an error when loading `pydataset` that says `No Module named 'pydataset'`, then execute this code in a new cell once: `!pip install --user pydataset`.\n", "\n", "2. [4 points] Using numpy compute the sample mean and sample standard deviation\n", "\n", "3. [6 points] Convert your data into a list (e.g., `l = list(sunspot_data[:,1])`) and write a `for` loop to compute the sample mean without using `numpy`\n", "\n", "4. [4 points] Use the `sort` method to find the median. " ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "# 3. Sleep deprevation\n", "\n", "1. [4 points] Load the sleep data. It contains change in reaction times in milliseconds of participants as a funciton of their sleep deprevation. Create a boxplot of the data where the x-axis is days of sleep deprevation.\n", "\n", "2. [2 points] Based on your plot, does reaction time change as you get less sleep?" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "# 4. Your Data\n", "\n", "In homework 1, I asked you to begin collecting data on two random processes. Please list again what your two things were and compute their mean, median and standard deviation. If your data does not have numerical values (e.g., colors, clothes), choose a random variable based on your data and compute it's mean. 6 points." ] } ], "metadata": { "kernelspec": { "display_name": "Python 3", "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.7.3" } }, "nbformat": 4, "nbformat_minor": 2 }