Dear all,
I have a time series data X and want to calculate the sum of squared residuals (SSR) at each time point.

SSR at time point m consists of two parts. The first part is the sum of squared residuals for all time points before m, and the second part is the sum of squared residuals for all time points after m (see below formula).



SSR(m) = sum_i (X_i - X1_bar)^2 + sum_j (X_j - X2_bar)^2, where i is from 0 to m and j is from m+1 to n.  X1_bar and X2_bar are the means for each segment.



I will get one SSR value for each data point. How do I use apply and its family (tapply, sapply, etc) to use vector manipulation to expediate this process?





Thanks!

Roy

________________________________
This e-mail message (including any attachments) is for t...{{dropped:14}}

