Multi linear regressoin with categorical variables

2 Ansichten (letzte 30 Tage)
In-chan Kim
In-chan Kim am 16 Jul. 2020
Kommentiert: Aditya Patil am 17 Aug. 2020
I want to run a multivariate linear regression with categorical variables.
My coding for mono with categorical works, as does multi with not categorical variables. I'm trying to figure out what the problem is!
% Doesn't work, needs fixing - Multivariate with categorical variables
mdllinallscenarioparams = fitlm(scenario{:,scenarioparams(4:5)},scenario.mean_benefitpercent,'CategoricalVars',[1:2],'VarNames',{'intgsystem','V2G','mean_benefitpercent'});
% Works, mono with categorical
mdllinallscenarioparams = fitlm(scenario{:,scenarioparams(4)},scenario.mean_benefitpercent,'CategoricalVars',[1],'VarNames',{'intgsystem','mean_benefitpercent'});
% Works, multi with not categorical
mdllinallscenarioparams = fitlm(scenario{:,scenarioparams(12:13)},scenario.mean_benefitpercent,'CategoricalVars',[1:2],'VarNames',{'PV','ESS','mean_benefitpercent'});
  1 Kommentar
Aditya Patil
Aditya Patil am 17 Aug. 2020
Can you provide more information, such as the complete code and the error that you are receiving?

Melden Sie sich an, um zu kommentieren.

Antworten (0)

Kategorien

Mehr zu Linear and Nonlinear Regression 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