{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "###
San Jose State University
Department of Applied Data Science
\n", "#
DATA 220
Mathematical Methods for Data Analysis
\n", "###
Spring 2021
Instructor: Ron Mak
\n", "#
Assignment #12
Polynomial Regression and Markov Chain Problem Set
\n", "####
100 points total (25 points each)

Work together with your lab partner.
Write your solutions in one or more cells after each problem.
Whenever possible, use matrix operations and not loops.
\n", "####
Due May 13, 2021
" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "
\n", "\n", "#### PROBLEM 1. Find the least-squares quadratic (degree 2) regression line through the following set of points." ] }, { "cell_type": "code", "execution_count": 1, "metadata": {}, "outputs": [], "source": [ "xs = [11, 12, 13, 14, 15, 17, 18, 19, 20, 21,\n", " 24, 25, 27, 28, 31, 32, 33, 36, 37, 38,\n", " 40, 41, 44, 45, 46, 49, 50, 51, 54, 55]\n", "\n", "ys = [11.3, 15.1, 6.6, 12.9, 12.1, 18.1, 20.9, 17.6, 11.0, 24.6,\n", " 11.3, 18.4, 16.2, 19.5, 35.8, 37.1, 45.7, 34.8, 25.6, 26.7,\n", " 22.0, 26.0, 10.5, 18.6, 21.1, 11.9, 13.7, 13.7, 6.3, 1.8]" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "#### Print the quadratic equation and plot it among the points." ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "
\n", "\n", "#### PROBLEM 2. If you have n points and you generate a least-squares polynomial of degree n-1, you've calculated the interpolation line that runs through all n points. This is also known as polynomial curve fitting.\n", "\n", "#### Calculate and plot the interpolation line for these points: (-2, 3), (-1, 5), (0, 1), (1, 4), and (2, 10)." ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "
\n", "\n", "#### PROBLEM 3.a. Amalgamated Widgets, Inc. ranks its employees by productivity: 1 (lowest), 2, 3, and 4 (highest). The following table shows for each rank, at the start of a new training program, the percentage of employees, the percentage productivity loss per employee, and the total percentage productivity loss.\n", "\n", "\n", " \n", " \n", " \n", " \n", " \n", " \n", "
RankEmployeesxProductivity loss=Total loss
130%40%12.00%
235%25% 8.75%
325%15% 3.75%
410% 5% 0.50%
Overall total25.00%
\n", "\n", "#### The training supervisor provided the following table that predicts what percentage of employees will move from one rank to another or stay in the same rank after each hourly training session, as determined by a test given at the end of the hour:\n", "\n", "\n", " \n", " \n", " \n", " \n", " \n", " \n", "
FROM:
TO:1234
150%30%10%10%
230%40%20%10%
320%30%20%10%
4  0%  0%50%70%
\n", "\n", "#### If training ends after two consecutive sessions with no rank changes to within three decimal places, how many hours will the training program last?" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "
\n", "\n", "#### PROBLEM 3.b. Compute directly (without iteration) the percentages of employees in each rank after all the training sessions have ended. Revise the first table in Problem 3.a to show the new percentage of employees in each rank. Assume the productivity loss of each rank hasn't changed, and include the new total loss percentage per rank and the overall total loss percentage. What percentage improvement resulted from the training?" ] } ], "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.7" } }, "nbformat": 4, "nbformat_minor": 4 }