# Curve fitting multivariate data for maximal correlation with univariate data?

I have multivariate time series data of the EURUSD financial vehicle. In this data each variable represents a different metric. There are ~200,000 rows and ~20 variables. There are no NULL values for any variable at any row. All data is numerical.

Alongside this data, at each time point I have the univariate data "Profit."

I want to curve-fit a function to transforms my multivariate data set into a new univariate data set which having the MAXIMAL correlation to my "Profit" variable.

In other words, I want to iterate through different mathematical transformations of my multivariate data set until I find the one that is optimally correlated with my "Profit" data.

What is the best way to do this? From what I understand, a genetic algorithm should work well.

-
This is a relatively ill-posed problem. You can achieve a correlation of 1 by creating 200000 variables from your 20 variables using powers, interactions, and other nonlinear functions of the data. To make this problem reasonable, you need to impose some regularity conditions on your data. If you are talking about curve fitting, these may be restrictions on the curvature (2nd derivative) of your resulting curve. I personally tend to trust splines a little bit more than the neural networks and other fancy stuff: just run a regression with splines as basis functions... doable in any package. –  StasK Jan 24 '12 at 1:33
What I am trying to do is to create 1 variable out of my 20, not 200000 out of 20. However, if need be, here are some constraints: 1. p value must maximally signififcant. 2. the formula must be symmetrically optimal for "buy" orders and "sell orders". But this is optional. How do I run a regression through a custom formula in, say, R? (pearson's correlation coefficient) –  Mike Jan 24 '12 at 3:48
Stask's point is that you can create 1 variable via any arbitrarily large number of intermediate additional variables (interactions, transformations, etc) so that by the time you have n of them you are guaranteed to have the maximum correlation with profit. –  Peter Ellis Jan 24 '12 at 10:37