From: martha on 14 Jun 2010 14:50 Hi all, I m about to approximate a set of data (stock indizes) with its fourier transform. In order to be able to compare it with other data sets, I was thinking about calculating the needed coefficients (for the ifft) given a pre-specified error term between the estimator and the original data (e.g. by MAE). I only managed to do it the other way round (calculate MAE given x (number of coefficients)). for x=1000, Y0=Y; Y0(x:end)=0; m = real(ifft(Y0)*L*2); mae=mean(abs(real(m(1:L)-y(:,1)))); end Any ideas how I could manage it the other way round? THANKS!
From: Walter Roberson on 14 Jun 2010 15:07 martha wrote: > Hi all, > > I m about to approximate a set of data (stock indizes) with its fourier > transform. In order to be able to compare it with other data sets, I was > thinking about calculating the needed coefficients (for the ifft) given > a pre-specified error term between the estimator and the original data > (e.g. by MAE). > I only managed to do it the other way round (calculate MAE given x > (number of coefficients)). > > for x=1000, Y0=Y; Y0(x:end)=0; > m = real(ifft(Y0)*L*2); > mae=mean(abs(real(m(1:L)-y(:,1)))); end > > Any ideas how I could manage it the other way round? Generate random (literally) N-1 coefficients. Calculate the MAE implied by them. If the MAE is too low or just right, you can calculate what the last coefficient would have to be in order to generate the desired MAE. If the MAE is too high, zero the last coefficient and move to the previous coefficient and calculate the MAE of all the other coefficients (including the zero), thus allowing you to calculate what the current coefficient would have to be to match the MAE. And so on, backing up as far as needed in order to get the required results. And yes, the implication _is_ that there an infinite number of solutions if there is more than one coefficient.
From: martha on 14 Jun 2010 15:44 Thanks Walter! Since I have quite a lot of data sets ti review: is there some code so that I don't have to trial and error but that MATLAB calculates it automatically?
From: Walter Roberson on 14 Jun 2010 16:04 martha wrote: > Thanks Walter! > > Since I have quite a lot of data sets ti review: is there some code so > that I don't have to trial and error but that MATLAB calculates it > automatically? For the purposes of discussion let the target vector be (1,2,3,4,5), and the target MAE be 1. This MAE can be achieved as (0,1,2,3,4) or (2,3,4,5,6) or (0,3,2,5,4) or (6,2,3,4,5) or (1,7,3,4,5) or (1,2,8,4,5) or ... What would be the point of getting one of these possibilities back at random? In my opinion, taking this approach would be a serious mistake in your pursuit of finding meaningful stock price coefficients to ifft.
From: martha on 14 Jun 2010 16:30 I agree in that case. However, I don't think I have clearly stated my aim: I want to figure out the number of coefficients (or datapoints embedded in the fourier transform) I need in order to get the ifft of that transform with a pre-specified error term - so that I would be able to compare various data points considering that measure.
|
Next
|
Last
Pages: 1 2 Prev: clabel numeric format and rotation Next: How two use info.xml with MATLAB R2008a .. R2010a |