Predicting

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • electromania
    New Member
    • Mar 2008
    • 20

    Predicting

    I need to write a program that can predict the stock market price indicies. The predictions are based on a very naive method that assumes that the market index is a linear function of time. Real life estimates are, of course, much more complicated and keep many people busy all over the globe. Our assumption that the market index, y, is a linear function of time, x, which means that the index can be written as:
    y = ax + b
    where a is the slope of the linear function and b is the intersection with the y-axis. Such an assumption is usually referred to as a model, i.e. we use a linear model to predict the stock market indicies.

    How do I go about starting this program as I'm not too strong on the maths side.
  • Meetee
    Recognized Expert Contributor
    • Dec 2006
    • 928

    #2
    Originally posted by electromania
    I need to write a program that can predict the stock market price indicies. The predictions are based on a very naive method that assumes that the market index is a linear function of time. Real life estimates are, of course, much more complicated and keep many people busy all over the globe. Our assumption that the market index, y, is a linear function of time, x, which means that the index can be written as:
    y = ax + b
    where a is the slope of the linear function and b is the intersection with the y-axis. Such an assumption is usually referred to as a model, i.e. we use a linear model to predict the stock market indicies.

    How do I go about starting this program as I'm not too strong on the maths side.
    I think your problem need some more analysis bacause AFAIK this site helps you in technical queries. Can you explain your problem in more detail as this seems to be a problem statement only.

    Thanks

    Comment

    • JosAH
      Recognized Expert MVP
      • Mar 2007
      • 11453

      #3
      Originally posted by electromania
      I need to write a program that can predict the stock market price indicies. The predictions are based on a very naive method that assumes that the market index is a linear function of time. Real life estimates are, of course, much more complicated and keep many people busy all over the globe. Our assumption that the market index, y, is a linear function of time, x, which means that the index can be written as:
      y = ax + b
      where a is the slope of the linear function and b is the intersection with the y-axis. Such an assumption is usually referred to as a model, i.e. we use a linear model to predict the stock market indicies.

      How do I go about starting this program as I'm not too strong on the maths side.
      The best you can do with this simple assumption (y being a linear function of x)
      is to do a linear regression given the data points (x_i, y_i) in order to find a and b.

      When you've found those values calculate the correllation coefficient and see that
      it is extremely small (very much near zero) telling you that your linear model is
      a nono for the data points.

      kind regards,

      Jos

      Comment

      • electromania
        New Member
        • Mar 2008
        • 20

        #4
        Originally posted by JosAH
        The best you can do with this simple assumption (y being a linear function of x)
        is to do a linear regression given the data points (x_i, y_i) in order to find a and b.

        When you've found those values calculate the correllation coefficient and see that
        it is extremely small (very much near zero) telling you that your linear model is
        a nono for the data points.

        kind regards,

        Jos
        Yes, your right but I need to find out the following tasks

        1. Test whether the linear model is a satisfactory description of the market index.
        2. If so, what the index will be in the future, i.e. can investments be recommended.

        I'll be taking inputs such as x/years and y/index.

        I have the formula for the graph and i know how to do it on paper. But I'm not sure where to start in writing a program to do that.

        I'm not sure how do i go about calculating this and see if its going towards negative or positive?

        Comment

        • JosAH
          Recognized Expert MVP
          • Mar 2007
          • 11453

          #5
          Originally posted by electromania
          Yes, your right but I need to find out the following tasks

          1. Test whether the linear model is a satisfactory description of the market index.
          2. If so, what the index will be in the future, i.e. can investments be recommended.

          I'll be taking inputs such as x/years and y/index.

          I have the formula for the graph and i know how to do it on paper. But I'm not sure where to start in writing a program to do that.

          I'm not sure how do i go about calculating this and see if its going towards negative or positive?
          Here's the Least Squares algorithm. All you have to do is translate it to C or C++.

          kind regards,

          Jos

          Comment

          Working...