MATLAB: Measuring fit of normcdf and multiple data points

rmsestatistics

Hi folks,
I have the figure shown above. The circles are discrete data points (x = IM, y = num_collapse./num_gms) from a series of tests; and the line is the result of a normcdf function — a line that was fit using maximum likelihood equation estimates. That is (with some missing code):
[theta_hat_mle, beta_hat_mle] = fn_mle_pc(IM, num_gms, num_collapse);
x_vals = 0.01:0.01:10;
p_collapse_mle = normcdf((log(x_vals/theta_hat_mle))/beta_hat_mle);
plot(x_vals,p_collapse_mle, lineType, 'linewidth', 1); % Line
plot(IM,num_collapse./num_gms, markerType, 'linewidth', 1); % Individual data points
I want to calculated the RMSE between the individual data points and the line. Can someone provide some insight? Is there an easy way to do that with the outputs of "plot"? Or just using the x- and y-inputs I've put into the plot() functions?
Thanks

Best Answer

Compute the error from the distance of the points to the line
err = p_collapse_mle(x_vals == IM) - num_collapse./num_gms;
RMS = sqrt(mean(err.^2));