Do You Know How Hackers Steal Your Credentials? Join us and Skyport Systems to learn how hackers steal your credentials and why Active Directory must be secure to stop them. Thursday, July 13, 2017 10:00 A.M. PDT

Become a Premium Member and unlock a new, free course in leading technologies each month.

Solved

Posted on 2006-11-30

Hello,

I am trying to find the linear regression of weight gain over time via MS SQL Server. I found a function for slope and im trying to apply it. I am looking for a conformation on this equation and if im applying it correctly.

Slope = ( COUNT(*)*SUM(x*y) -SUM(x)*SUM(y) ) / (COUNT(*)*SUM(x^2)-SUM(x)^2)

The site i found it said x is date and y is weight. I figured (correct me if im wrong) that x would be the age of the bird in days so i came up with the following query....

SELECT

(COUNT(*)*SUM(Cast(DateDiff(dd, [Hatch Date], [Date]) As Float)*Weight) -SUM(Cast(DateDiff(dd, [Hatch Date], [Date]) As Float))*SUM(Weight) ) / (COUNT(*)*SUM(Cast(DateDiff(dd, [Hatch Date], [Date]) As Float)^2)-SUM(Cast(DateDiff(dd, [Hatch Date], [Date]) As Float))^2)

FROM

WingbandFlock As wf

INNER JOIN

Weight As w

ON

wf.[Bird ID] = w.[Bird ID]

In concept, am i correct? I am still running into an SQL error i have not solved, if you know that you can post the answer in my related question for more points :)

http://www.experts-exchange.com/Databases/Microsoft_SQL_Server/Q_22077814.html#a18045854

Thanks!

-Navicerts

I am trying to find the linear regression of weight gain over time via MS SQL Server. I found a function for slope and im trying to apply it. I am looking for a conformation on this equation and if im applying it correctly.

Slope = ( COUNT(*)*SUM(x*y) -SUM(x)*SUM(y) ) / (COUNT(*)*SUM(x^2)-SUM(x)^

The site i found it said x is date and y is weight. I figured (correct me if im wrong) that x would be the age of the bird in days so i came up with the following query....

SELECT

(COUNT(*)*SUM(Cast(DateDif

FROM

WingbandFlock As wf

INNER JOIN

Weight As w

ON

wf.[Bird ID] = w.[Bird ID]

In concept, am i correct? I am still running into an SQL error i have not solved, if you know that you can post the answer in my related question for more points :)

http://www.experts-exchange.com/Databases/Microsoft_SQL_Server/Q_22077814.html#a18045854

Thanks!

-Navicerts

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

- Help others & share knowledge
- Earn cash & points
- Learn & ask questions

2 Comments

Thanks again!

SELECT

(Count(*)*SUM(Cast([Feed Consumed] As float)*([Weight Gain]*453.6)) -SUM(Cast([Feed Consumed] As float))*SUM(([Weight Gain]*453.6)) ) / (Count(*)*SUM(power(Cast([

FROM

WingbandFlock As wf

INNER JOIN

[Feed Consumed] As fc

ON

wf.[Bird ID] = fc.[Bird ID]

INNER JOIN

[Keepers Report] As kr

ON

wf.[Bird ID] = kr.[Bird ID]

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Earn Certification

HTML5 Specialist - Certification

Free withPremium

Course of the Month7 days, 21 hours left to enroll

Earn Certification

Lean Six Sigma Yellow Belt

$99.00$89.10

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