Effacer les filtres
Effacer les filtres

error from a relationship

1 vue (au cours des 30 derniers jours)
Mary292
Mary292 le 21 Fév 2015
Commenté : Star Strider le 4 Mar 2015
oahfidsigbosga igoahaighaoeighoaw lagihsgibsohgaiesubg \suigh\seugbeisugi\seubvieu usgziseugbisu\bgzdbgz zgbzdsgubgisugziu fu\iesgi\eliueg\zjxbvkzsdbgi khifsohi\eg
  1 commentaire
Star Strider
Star Strider le 4 Mar 2015
Context: ‘Mary292’ originally asked how to determine the error with respect to a linear regression applied to perturbed data with a model derived from unperturbed data on the same system. The system was initially unperturbed (the first 2000 data pairs, on which the regression was performed), then perturbed.

Connectez-vous pour commenter.

Réponse acceptée

Star Strider
Star Strider le 21 Fév 2015
Your model is the linear regression of the first 2000 points. To get the model predictions for the rest of the data, ‘plug in’ the values for your independent variable for the rest of your data in your model. The output of your model are the predictions for those values. To get the error, subtract your predictions from the dependent variable data for those same values of the independent variable.
To illustrate:
x = linspace(0,200); % Create Data
y1 = 0.5*x(1:50) + 0.1*randn(1,50) + 1.2; % Create Data To Fit
y2 = 0.6*x(51:100) + 0.1*randn(1,50) + 1.5; % Create Data To Evaluate Error
b = polyfit(x(1:50), y1, 1); % Parameter Estimates
yfit = polyval(b, x); % Predict Entire Data Set
model_error = yfit - [y1 y2]; % Calculate Error
figure(1)
plot(x, [y1 y2], 'xr')
hold on
plot(x, yfit, '-b')
hold off
grid
legend('Data', 'Model Fit', 'Location','SE')
  5 commentaires
Mary292
Mary292 le 22 Fév 2015
Thank you! You've been a great help
Star Strider
Star Strider le 22 Fév 2015
My pleasure! And thank you for the compliment!

Connectez-vous pour commenter.

Plus de réponses (0)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by