Mathematical Modeling: Regression

AI Thread Summary
The discussion revolves around fitting restaurant reservation data to a sinusoidal model using sine and cosine functions. Participants are trying to understand how to transition from a cosine function to a sine function and the implications of horizontal shifts in the graph. There is confusion about the concept of regression and how to calculate the necessary parameters for the sinusoidal model. The conversation highlights the need for clarity in problem statements and the mathematical relationships between sine and cosine functions. Ultimately, the participants are seeking guidance on how to effectively apply these concepts to their data analysis.
FritoTaco
Messages
132
Reaction score
23

Homework Statement


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

Homework 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

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?
IMG_0146 (2).JPG

IMG_0147 (1) (2).JPG
 
Physics news on Phys.org
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
 
Buzz Bloom said:
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

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?
 
FritoTaco said:
are you asking about the parent functions and the domain and range?
FritoTaco said:
I just don't understand how to go from Cosine Function to Sine Function.
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).

FritoTaco said:
I understand how to get Cosine function because that's what I did but Sine function is suppose to change.
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
 
Buzz Bloom said:
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

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.
 
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
 
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?
 
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
 
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
FritoTaco said:
What I don't understand is how to get the sine function of what I highlighted.
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
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.
Buzz Bloom said:
You want to find the values for A and B, or for C and D, which minimizes the sum of the errors squared.
The work shown in both of your attachments do not show any such a calculation. What do you think "regression" means?

Regards,
Buzz
 
  • #12
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
haruspex said:
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.)

I was actually trying to get cosine to sine
 
  • #14
  • #15
FritoTaco said:
I was actually trying to get cosine to sine
Yes, sorry, typo. But what I posted is still relevant.
 
Back
Top