1. Limited time only! Sign up for a free 30min personal tutor trial with Chegg Tutors
    Dismiss Notice
Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Mathematical Modeling: Regression

  1. Feb 12, 2016 #1
    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?
    IMG_0146 (2).JPG
    IMG_0147 (1) (2).JPG
  2. jcsd
  3. Feb 12, 2016 #2
    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?

  4. Feb 13, 2016 #3
    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?
  5. Feb 13, 2016 #4
    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.

  6. Feb 13, 2016 #5
    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.
  7. Feb 13, 2016 #6
    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?

  8. Feb 13, 2016 #7
    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?
  9. Feb 13, 2016 #8
    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?

  10. Feb 13, 2016 #9
    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)?
  11. Feb 14, 2016 #10


    User Avatar
    Science Advisor
    Homework Helper
    Gold Member

    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.)
  12. Feb 14, 2016 #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.
    The work shown in both of your attachments do not show any such a calculation. What do you think "regression" means?

  13. Feb 15, 2016 #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.
  14. Feb 15, 2016 #13
    I was actually trying to get cosine to sine
  15. Feb 15, 2016 #14
  16. Feb 15, 2016 #15


    User Avatar
    Science Advisor
    Homework Helper
    Gold Member

    Yes, sorry, typo. But what I posted is still relevant.
Know someone interested in this topic? Share this thread via Reddit, Google+, Twitter, or Facebook

Have something to add?
Draft saved Draft deleted

Similar Discussions: Mathematical Modeling: Regression
  1. Mathematical model (Replies: 4)

  2. Mathematical Modelling (Replies: 12)

  3. Cubic Regression (Replies: 8)

  4. Sine Regression (Replies: 2)