How can i plot the predicted linear model ?

1 Ansicht (letzte 30 Tage)
Gorkem Akgul
Gorkem Akgul am 1 Mai 2021
Hi, I have trained a linear regression model and plot it using the plot function.
plot(linearmodel)
The problem is that, i also want to plot the response for my test data. As it seems there is not only single linear line. There are couple of lines that is probably used inking each sequential point in the data set( i have learnt this thanks to someone on another platform). How can i reduce it into a single line ?
scatter(coviddataset.sum_Deaths,coviddataset.sum_Deaths); hold on
y=predict(linearModel,coviddataset);
line(coviddataset.sum_Deaths, y,'Color','r')
legend('Training data', 'Linear regression'); hold off
I used the code above and it gives the graph.

Antworten (0)

Kategorien

Mehr zu Statistics and Machine Learning Toolbox finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by