# Homework Help: Mathematical Modeling: Regression

1. Feb 12, 2016

### FritoTaco

1. The problem statement, all variables and given/known data
Restaurant Reservations for a given week were:
Monday - 34
Tuesday - 27 (minimum value)
Wednesday - 33
Thursday - 47
Friday - 58
Saturday - 61 (maximum value)
Sunday - 42

2. Relevant equations
I don't think you need these equations to help me solve what I'm stuck on
Amplitude: Midline - minimum
Midline: Max + min / 2
Period: b = 2|max + min| then 2pi / b

3. The attempt at a solution
What I don't understand is how to get the sine function of what I highlighted. I think you have to look at the parent function of sin and cos and try to get to sin. If I'm originally at (x-6) according to my Cosine function to the left of my Sine Function, where is that on the graph table of Cosine? And how do I get my new value if I want to go to the start of Sine?

2. Feb 12, 2016

### Buzz Bloom

HI FritoTaco:

The problem statement does not describe the problem to be solved. Presumably it has something to do with calculating a regression curve that best fits the data, but what are the constraints about the family of curves you can use?

Regards,
Buzz

3. Feb 13, 2016

### FritoTaco

Hi Buzz, are you asking about the parent functions and the domain and range? Because I don't think that matters for this. I just don't understand how to go from Cosine Function to Sine Function. I understand how to get Cosine function because that's what I did but Sine function is suppose to change. That's what I don't understand how to do but I think I need to look at the parent function. Ignore the Run a Sin-Regression because that's just the calculators calculation. Any ideas though?

4. Feb 13, 2016

### Buzz Bloom

Hi FritoTaco:

I do not know what "parent function" means.
I do not understand why you are fitting the data to a sin or cos (or combination).

I do not understand why you can fit a cos function, but a sin function is "suppose to change".

I expect that a problem statement sets up all the requirements for what is expected in a correct solution. You seem to have a lot of ideas about sin and cos functions that are not explained in the problem statement.

Regards,
Buzz

5. Feb 13, 2016

### FritoTaco

The reason I'm having trouble explaining this is because I don't know why the Sine function is suppose to change either. I can calculate the cosine function as I did but I need to move the horizontal shift so it matches the Sine function. The parent function is the 2 graphs shown in the second picture of Sine and Cosine, It's just suppose to guide you on how far the horizontal shift should change. I tried looking this up online but couldn't find any solutions. I don't know what I should do.

6. Feb 13, 2016

### Buzz Bloom

Hi FritoTaco:

While I find the way you have expressed the problem to be confusing, I think I am beginning to get what you are trying to do.

I think you are looking for a sinusoidal periodic function that best fits the data. The period is given as one week. (I am guessing that this is because each week's daily reservation counts are expected to be similar to other weeks.)

The form of the function you want to fit to the data is
f(t) = A sin ((2π/7) t) + B cos ((2π/7) t).
Alternatively you can fit to
f(t) = C sin ((2π/7) t + D).
These two forms are equivalent to each other, since if you know A and B, you can calculate C and D, and vice versa.

You want to find the values for A and B, or for C and D, which minimizes the sum of the errors squared. Do you know how to do this?

Regards,
Buzz

7. Feb 13, 2016

### FritoTaco

Hey Buzz, I have A, B, and D, I don't know how to calculate for C? Also, what is the variable t in f(t) = A sin ((2π/7) t) + B cos ((2π/7) t)? Is that suppose to be D?

8. Feb 13, 2016

### Buzz Bloom

Hi FritoTaco:

t is time in days. Since you list Monday first, you can make t=0 be Monday, t = 1 be Tuesday, etc.

It seems unlikely that you can have the correct value for C independently of D. To figure out how C and D relate to A and B, you need to know the formula for the following:
sin(x+y) = ?

Do you know this? If not, you can probably find it in your textbook or on the internet.

Can you post your work on how you got A and B?

Regards,
Buzz

9. Feb 13, 2016

### FritoTaco

hey Buzz, I have shown how to get A and B, and even D. A value: Mid - min (44-27 = 17), and B value: 2|max - min|, so 2|6-2| = 2|4| = 8. But use 7 instead because 7 days a week. (b = 2pi / 7 = 0.89). So now I need to use sin(x+y)?

10. Feb 14, 2016

### haruspex

Not sure I have understood, but I think all you are asking is how to take an equation like y=Asin(Bx+C) and turn it into y=Acos(B'x+C').
If so, consider what sin(π/2-θ) equates to.
(Note my use of B' in the cos form.)

11. Feb 14, 2016

### Buzz Bloom

Hi FritoTaco:

It seems that both haruspex and I are unsure what the problem is you are trying to solve. I will make one more try.

You use the word "regression" in the title of this thread. The following is my understanding of what "regression" WRT your problem statement.
The work shown in both of your attachments do not show any such a calculation. What do you think "regression" means?

Regards,
Buzz

12. Feb 15, 2016

### FritoTaco

It's fine, I was trying to see if there were any ideas which there were but couldn't conclude the problem. I do not understand the term regression. I didn't know how to show calculations for going from sine to cosine. No problem, thank you so much for your efforts.

13. Feb 15, 2016

### FritoTaco

I was actually trying to get cosine to sine

14. Feb 15, 2016

### Buzz Bloom

Hi Frito:

You may find the following article in Wikipedia useful.

Good luck.

Regards,
Buzz

15. Feb 15, 2016

### haruspex

Yes, sorry, typo. But what I posted is still relevant.