Answered step by step
Verified Expert Solution
Question
1 Approved Answer
CS103 Introduction to Computation Johnstone Spring 2018 Lab 11: Statistics and doestrings (3.30.18 and 4.2.18) In this lab, you will write code to compute some
CS103 Introduction to Computation Johnstone Spring 2018 Lab 11: Statistics and doestrings (3.30.18 and 4.2.18) In this lab, you will write code to compute some statistics of a dataset. Mean and variance are impoetant measures that give valuable information about a dataset Note that today you are creating your own functions and docstrings and test data, which is part of the exercise. Please write docstrings carefully using the 103 style guide, (which are also followed in the code I provide each lecture). Relevant lectures: lecture 19 and 20 1. Write a function to compute the mean of a list of integets L of length n Motivation: we are assuming that each element o L. occurs with equal probability so we are weighting each one by1 2. Write a function to compute the variance V of a list of integers L of length n: This measures the spread or disperslon of the data. 3. Write a function to compute the standard deviation D of a list of integers L; if the varianoe of L is V then the standard devlation is Grading: Code for mean, variance, and standard deviation. If and when you ???plete the above, please proceed with the following experiment. This will prepare you for Monte Carlo slmulations. 1. write a function to toss a fair ooln; it sboald return True if the coin toss yields Heads and False if the coln toss yields Tails 2. write a fanction to toss a fair coin 100 times and count the number of heads; (we will all this an 3, write a functi? to repeat this experiment 1000 times, and compute the mean of the # of heads 4. compute the standard deviation of these experiments Repeat this exercise for a biased coin, with probability po, of heads CS103 Introduction to Computation Johnstone Spring 2018 Lab 11: Statistics and doestrings (3.30.18 and 4.2.18) In this lab, you will write code to compute some statistics of a dataset. Mean and variance are impoetant measures that give valuable information about a dataset Note that today you are creating your own functions and docstrings and test data, which is part of the exercise. Please write docstrings carefully using the 103 style guide, (which are also followed in the code I provide each lecture). Relevant lectures: lecture 19 and 20 1. Write a function to compute the mean of a list of integets L of length n Motivation: we are assuming that each element o L. occurs with equal probability so we are weighting each one by1 2. Write a function to compute the variance V of a list of integers L of length n: This measures the spread or disperslon of the data. 3. Write a function to compute the standard deviation D of a list of integers L; if the varianoe of L is V then the standard devlation is Grading: Code for mean, variance, and standard deviation. If and when you ???plete the above, please proceed with the following experiment. This will prepare you for Monte Carlo slmulations. 1. write a function to toss a fair ooln; it sboald return True if the coin toss yields Heads and False if the coln toss yields Tails 2. write a fanction to toss a fair coin 100 times and count the number of heads; (we will all this an 3, write a functi? to repeat this experiment 1000 times, and compute the mean of the # of heads 4. compute the standard deviation of these experiments Repeat this exercise for a biased coin, with probability po, of heads
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started