Prediction based on best fit linear regression model

1 次查看(过去 30 天)
Hi,
I have the below data(train_data, test_data), and I want to do following:
  1. In train set some of point or outliears, and I want evaluate best fit model based on mean squared error
  2. Prediction based on best fit model.
Train_data:
x y
1 1
2 3
6 6
8 2
11 15
15 9
21 11
25 14
Test set:
x
5
12
21
23
my desired output(i.e, y:)
4
7
12
13

回答(1 个)

the cyclist
the cyclist 2017-8-11
It looks like you have the Statistics and Machine Learning Toolbox. I would use fitlm to fit the model on the training data.
Then you can use the predict method to make a prediction on the test set.
  2 个评论
Mekala balaji
Mekala balaji 2017-8-11
Sir, I can use fitlm. But sir, there are some outliers due which the rsquare is very poor, I want to evaluate by taking how many input data (drop others) such that we get higher rsquare.
the cyclist
the cyclist 2017-8-11
You can do "robust" fitting (with fitlm, or other MATLAB functions). This is a common way of handling outliers. The documentation page I linked has the details on how to do this.
This Wikipedia page discusses robust methods.

请先登录,再进行评论。

Community Treasure Hunt

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

Start Hunting!

Translated by