Squared difference of each element in a vector
Posted: Wed Mar 08, 2017 9:52 am
Hi I'm sorry this is such a basic question, but I cannot find the answer in Eviews help forum.
I have a 1x10 vector of eigenvalues and I have a scalar mean of those eigenvalues. For each element of the vector, I'd like to subtract the mean, square the difference and sum the squared differences.
In Matlab the syntax would be:
sum((eigen-mean_eigen).^2)
I thought the EViews syntax would be simple and I've been trying this:
But, I'm getting an error message that states "Vector raised to scalar." Which is odd. The result should indeed be a scalar, but I don't understand the problem here.
I have a 1x10 vector of eigenvalues and I have a scalar mean of those eigenvalues. For each element of the vector, I'd like to subtract the mean, square the difference and sum the squared differences.
In Matlab the syntax would be:
sum((eigen-mean_eigen).^2)
I thought the EViews syntax would be simple and I've been trying this:
Code: Select all
vector C1F3 = @sum((eig_d4 - mean_eig_d4)^2)