dbTalk Databases Forums  

Problems using LinRegR2

microsoft.public.sqlserver.olap microsoft.public.sqlserver.olap


Discuss Problems using LinRegR2 in the microsoft.public.sqlserver.olap forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Ash
 
Posts: n/a

Default Problems using LinRegR2 - 08-18-2006 , 12:36 PM






Hi All,

I'm currently trying to use LinRegR2 as follows:

LinRegR2(lastperiods(60), [Measures].[Growth_Avg], ?????)

I would like to regress the growth_avg measure against the following
series (1,2,3,...,60). So, essentially I'm regressing against a time
series from 1 to 60. I cannot seem to figure out how to fill in the
question marks with a set of numbers going from 1 to 60.

Is it as simple as putting in 1,2,3,...,60 in a comma delimited format?

i.e. LinRegR2(lastperiods(60), [Measures].[Growth_Avg], (1,2,3,...,60))


Any help would be appreciated.


Reply With Quote
  #2  
Old   
Deepak Puri
 
Posts: n/a

Default Re: Problems using LinRegR2 - 08-18-2006 , 06:01 PM






BOL provides this syntax and an example for LinReg2:

http://msdn2.microsoft.com/en-us/library/ms145494.aspx
Quote:
SQL Server 2005 Books Online

LinRegR2 (MDX)

Updated: 17 July 2006

Syntax

LinRegR2(Set_Expression, Numeric_Expression_y [ ,Numeric_Expression_x ]
)

Example
The following example returns the statistical R2 that describes the
goodness of fit of the linear regression equation to the points for the
unit sales and the store sales measures.

LinRegR2(LastPeriods(10), [Measures].[Unit Sales],[Measures].[Store
Sales])
Quote:

Based on this, the 3rd argument could be like:

LinRegR2(LastPeriods(60) as [TimeSet],
[Measures].[Growth_Avg],
Rank(Time.CurrentMember, [TimeSet]))


- Deepak

Deepak Puri
Microsoft MVP - SQL Server

*** Sent via Developersdex http://www.developersdex.com ***


Reply With Quote
  #3  
Old   
Ash
 
Posts: n/a

Default Re: Problems using LinRegR2 - 08-21-2006 , 12:42 PM



Thanks Deepak,

Worked perfectly.

Deepak Puri wrote:
Quote:
BOL provides this syntax and an example for LinReg2:

http://msdn2.microsoft.com/en-us/library/ms145494.aspx

SQL Server 2005 Books Online

LinRegR2 (MDX)

Updated: 17 July 2006

Syntax

LinRegR2(Set_Expression, Numeric_Expression_y [ ,Numeric_Expression_x ]
)

Example
The following example returns the statistical R2 that describes the
goodness of fit of the linear regression equation to the points for the
unit sales and the store sales measures.

LinRegR2(LastPeriods(10), [Measures].[Unit Sales],[Measures].[Store
Sales])



Based on this, the 3rd argument could be like:

LinRegR2(LastPeriods(60) as [TimeSet],
[Measures].[Growth_Avg],
Rank(Time.CurrentMember, [TimeSet]))


- Deepak

Deepak Puri
Microsoft MVP - SQL Server

*** Sent via Developersdex http://www.developersdex.com ***


Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.