Multivariant regression, fitting the curve with multiple variables .

6 views (last 30 days)
I have a data sets where, one response variable is dependant on three other variables... how can I make model which can predict the response variable with new three variables in matlab ?

Answers (1)

Puru Kathuria
Puru Kathuria on 4 Mar 2020
Hi,
I understand that you want to fit a line/curve to your dataset. Assuming X is your data matrix with NxM dimensions where N is the number of data samples, M is the number of variables (3 in your case)[MA1] and Y is your target variable(to be predicted). You can use Linear Regression to fit a line to the data or other polynomial regression techniques to fit a curve to your data and predict the value of your target variable Y.
Example:
% Fit linear Regression Model
% Xtrain: Matrix of training data
% Ytrain: Target/Predicted variable
model = fitlm(Xtrain,ytrain);
% Xtest: test dataset whose corresponding Y is to be predicted
Ypredicted = model.predict(Xtest);
% To fetch the coefficients computed by your model
model.Coefficients
% Metrics to judge your fit/model
model.Rsquared.Adjusted
model.Rsquared.Ordinary
Go through the following links to see more about line fitting and polynomial fitting:

Community Treasure Hunt

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

Start Hunting!