From: Maria on
Hi,

Im trying to calculate the mean squared error for an original function and its estimate. I have not found a proper solution, yet.
I have tried:

y = original data
data_approx = estimator

1.)
e = (data_approx(:,1)-y(:,1)).^2;
mse=mean(e)

2.)
diff=data_approx(:,1)-y(:,1);
mse=mean(diff.^2)

3.)
[x,stdx,mse] = lscov(y, data_approx)

4.)
[mse] = lscov(data, data_approx)

They certainly all yield solutions, but what would be the right one? Are there other solutions?

Thanks for your help!
From: dpb on
Maria wrote:
> Hi,
>
> Im trying to calculate the mean squared error for an original function
> and its estimate. I have not found a proper solution, yet. I have tried:
>
> y = original data
> data_approx = estimator
>
> 1.)
> e = (data_approx(:,1)-y(:,1)).^2;
> mse=mean(e)
>
> 2.)
> diff=data_approx(:,1)-y(:,1);
> mse=mean(diff.^2)
>
> 3.)
> [x,stdx,mse] = lscov(y, data_approx)
>
> 4.) [mse] = lscov(data, data_approx)
>
> They certainly all yield solutions, but what would be the right one? Are
> there other solutions?
>

Commonly one uses root mean square...

--