Generating Student Samples and Plot

Generate student samples and plot their morale over time.

We'll cover the following

Let’s generate samples for some students, “A,” “B,” “C,” and so on, considering their morale was randomly measured 15 times throughout the semester (not necessarily at the same times).

Generate data

Let’s write a small function and use our interpolated function morale_func to generate data. Remember that we need to pass the days to the morale_func that will return the morale for the respective day. Once we have the value for morale, we can add a measurement error (individual variance) using numpy.random.normal() with the normal distribution.

Get hands-on with 1200+ tech skills courses.