Today in precalculus, we looked at some data that follow a sinusoidal pattern and calculated a regression function to model it. Here’s how we did it:

The hours of daylight over a year increase, then decrease in a regular, periodic fashion – just the kind of data that result in a nice sine curve. The US Navy maintains a website where you can enter any location and see the sunrise and sunset times over an entire year:

http://aa.usno.navy.mil/data/docs/RS_OneYear.php

We entered our location (Nashville, TN), and used the sunrise and sunset times for the middle of the months:

The times are given in hours and minutes, so we converted them to decimal hours. We then subtracted sunrise time from sunset time to get the number of daylight hours for each month:

Now that we had our data, we entered it into our graphing calculators:

After setting our window parameters, we plotted the data:

Nice! Next, we calculated the regression function that best fits the data (This might be a good time to discuss pros and cons of different regression functions: quadratic, cubic, quartic, etc.):

We then plotted the regression function with the data points. Nice fit!

Because we did this in mid-February (x = 2.5), we used our model to estimate how many hours of daylight we should expect to have today: 11.4 hours.

If you’re ready to move beyond graphing calculators (and I certainly am!), then you can do this activity with the Desmos online function grapher. What’s nice about that approach is the ability to set up sliders, and let students fit the regression function to the data manually.

Here are a couple of screenshots:

**Update: **Apparently this is the source of the Chinese Yin/Yang symbol.

### Like this:

Like Loading...

*Related*

Very cool! Can’t stop singing the “Fiddler on the Roof” song. I love the real world application of this.

Glad you caught the musical reference, Meg!

How do you find the regression function and is there a difference if i did mine a specific day from each month of a whole year in order to find x?

If not, what would mind be if i did it the 8th day of each month?

If so, how do I find it?

Also how am I going to be able to find the a,b,c and d on the graph? Are they plotted points already or would i need an equation to find it? Or just play with Desmos till I get the line?

(I am doing a presentation on this for my Pre-Calculus class and well I would like to know a ‘why i need this’ for all the questions I am asking…this would help a lot…thank you)

Hi Goretti,

I think you will be fine if you pick the same day for each month. The US Navy link I included in the post has all of that data. You just enter your location, and pick which day of the month you want to use.

We used our TI-84 calculators to derive the regression equation (STAT/CALC/SinReg). From the equation the TI-84 gives you, you can get a, b, c, and d. You can also calculate them by hand, if you want. For example, the period is 12 months, so b = 2pi/12. Desmos has a built-in regression feature now, if you want to use that. We set up a general y = a*sin(b*(x-c))+ d function with sliders for a, b, c, and d, and used trial and error to match the data. I hope this helps; good luck with your presentation!