PDA

View Full Version : Help with Analyzing Stocks

kurtvon
12-15-2008, 04:13 PM
I'm working on a project for school and need help! What I am trying to do is create a regression channel for the stock market.

The data I have to work with is from *****! Finance which includes OPEN, HIGH, LOW, and CLOSING prices.

What I want to do is find the regression line with this data. I would like to use the least squares method to do so but am confused about how to go about it. I'm not sure exactly what data is suppose to be used for what variables? How would I set up the math?

Also, is there a way to do this in excel? I know how to use the regression analysis in excel but don't know what the dependent and independent variables would be for this data to find the regression equation.

Also, I want to plot two support and resitance lines, which would be two standard deviations from the regression line. How would I do this?

Thanks!!!

gatormka
12-15-2008, 05:44 PM
I'm working on a project for school and need help! What I am trying to do is create a regression channel for the stock market.

The data I have to work with is from *****! Finance which includes OPEN, HIGH, LOW, and CLOSING prices.

What I want to do is find the regression line with this data. I would like to use the least squares method to do so but am confused about how to go about it. I'm not sure exactly what data is suppose to be used for what variables? How would I set up the math?

Also, is there a way to do this in excel? I know how to use the regression analysis in excel but don't know what the dependent and independent variables would be for this data to find the regression equation.

Also, I want to plot two support and resitance lines, which would be two standard deviations from the regression line. How would I do this?

Thanks!!!

K,

In order to create a regression model, you need to know what question you're trying to answer. You have to define the dependent variable in terms of the explanatory (independent) variables. So what are you trying to determine?

It appears like you're assigned to perform technical analysis of stock price(s). In that methodology, define price is a function of time in order to estimate the price trend. What price should you use? Generally, closing prices are used in research, but you should verify this for your assignment.

In this case, your linear regression model would be: Price=Day+e, where e is a white noise residual. You can certainly plot a regression line in Excel. You can use Google to find instructions.

Good luck!

kurtvon
12-15-2008, 06:53 PM
Sorry, but that isn't making sense to me. With your equation which has day as the independent variable, it seems impossible to "estimate" price becuase you do not have a way to define day in terms of a numerical answer. When I ran the regression analysis using day as the independent variable and price as the dependent variable, I got an equation with an extreamly high intercept coefficient. I would think that it should be somewhere in the range of the stock price.

If I wanted to estimated the price for tomorrow, my regression equation should spit out a value near to the previous days to be accurate.

this is what I am looking to do....

http://www.metaquotes.net/techanalysis/linestudies/linear_regression_channel

kurtvon
12-15-2008, 07:00 PM
I think I may have found out what was going wrong. My data for days was being expressed in actual date format whereas it should have been put in 1,2,3,4....and so on. It gave me an equation with an intercept that makes a lot more sense now.

I still may have some trouble figuring out the least squares method however, but I'll take another look.

Doing it in excel doesn't seem like it will not be a problem however.

gatormka
12-15-2008, 09:15 PM
I think I may have found out what was going wrong. My data for days was being expressed in actual date format whereas it should have been put in 1,2,3,4....and so on. It gave me an equation with an intercept that makes a lot more sense now.

I still may have some trouble figuring out the least squares method however, but I'll take another look.

Doing it in excel doesn't seem like it will not be a problem however.

I haven't done technical analysis of stock prices before--not to mention regression channels, but it seems to me that the specification I gave you (which is better represented by P=a+b*Day+e) should do the trick. All that least squares does is to estimate coefficients that minimize the sum of squared error terms.

In terms of the channels, they seem to be parallel to the regression line (so the slope still =b), differing only by their intercept (a+/- X). You had mentioned that the difference was some factor of the standard deviation of prices. That way, you just have to calculate the necessary price variance over the period of interest, and calculate the standard deviation (X). Now you have your channel.

-gator