Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

CR9: Covariance of an array

Status
Not open for further replies.

JStandard

Programmer
Mar 15, 2005
22
US
Greetings,

CR 9.2.3.1256, SQL Server

I attempting to use the Covariance function but keep receiving "A number field or currency amount field is required" when attempting to take the covariance of one field containing a list of returns, and an array of numbers computers on the same report.

Ex.
db1.fldA is a direct link to a field in a table with the following structure: Key, Value, Date

arrValues is an array of values calculated in the report, which I build using:

Code:
numbervar array arrValues;
arrValues := [{@Calc 1}, {@Calc 2}, {@Calc 3}]

So, given such, I attempt to take the covariance of both of these number series using:

Code:
covariance(db1.fldA, arrValues)

Of which I receive the error message: "A number field or currency amount field is required"

Which basically means the covariance formula does not want to accept the array of numbers as an argument and wants a database style field.

Is there any way I can somehow take the covariance of these two sets of numbers, one of the sets being an array of calculations from the report?

For any finance reporters out there, my end goal is to calculate the beta of some calculated return streams versus a return stream from an index, pulled from the "db1" database. Beta = Covariance(x,y) / variance(x) where x = index return stream and y = calculated return stream.

Thanks Kindly,

Jeff
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top