Solved

Posted on 2004-11-22

Hi,

I need to create a daily regression on a table with 3 columns (ItemCode, Date, SaleQty).

I tried working with “LinRegIntercept” but couldn’t understand how to work with “LastPeriods”.

Is this the right way to work?

Can someone send me a full example?

10X

I need to create a daily regression on a table with 3 columns (ItemCode, Date, SaleQty).

I tried working with “LinRegIntercept” but couldn’t understand how to work with “LastPeriods”.

Is this the right way to work?

Can someone send me a full example?

10X

9 Comments

I guess you are right.

Should I install or do anything before working with MDX?

Does it have a driver?

10X

DECLARE n float, Sx float, Sy float, Sxx float, Syy float, Sxy float, a float, b float, r float

SELECT n = COUNT(*), Sx = SUM(x), Sy = SUM(y), Sxx = SUM(x * x), Syy = SUM(y * y), Sxy = SUM(x * y)

FROM Table

SET b = (n * Sxy - Sx * Sy) / (n * Sxx - Sx * Sx)

SET a = (Sy - b * Sx) / n

SET r = (n * Sxy - Sx * Sy) / SQRT((n * Sxx - Sx * Sx) * (n * Syy - Sy * Sy))

I created a table with two float columns (X, Y).

I get the following error:

'float' is not a recognized CURSOR option.

10X

DECLARE @n float, @Sx float, @Sy float, @Sxx float, @Syy float, @Sxy float, @a float, @b float, @r float

SELECT @n = COUNT(*), @Sx = SUM(x), @Sy = SUM(y), @Sxx = SUM(x * x), @Syy = SUM(y * y), @Sxy = SUM(x * y)

FROM #tmpdm

SET @b = (@n * @Sxy - @Sx * @Sy) / (@n * @Sxx - @Sx * @Sx)

SET @a = (@Sy - @b * @Sx) / @n

SET @r = (@n * @Sxy - @Sx * @Sy) / SQRT((@n * @Sxx - @Sx * @Sx) * (@n * @Syy - @Sy * @Sy))

By clicking you are agreeing to Experts Exchange's Terms of Use.

Title | # Comments | Views | Activity |
---|---|---|---|

Could you break this down for me? | 5 | 25 | |

Unable to change SQL 2008 from Windows Authentication to Windows/SQL mixed mode | 10 | 24 | |

VB.net list SQL views in the order they were created | 4 | 16 | |

How can I find a table in SQL server 2016 | 4 | 17 |

Join the community of 500,000 technology professionals and ask your questions.

Connect with top rated Experts

**10** Experts available now in Live!