Multiple regression with nonlinear variables

5 Ansichten (letzte 30 Tage)
Fernando Maturi
Fernando Maturi am 29 Jan. 2025
Kommentiert: Star Strider am 2 Feb. 2025
Hello,
I am working with the attached dataset, where the first column represents temperature and the next six columns (2–7) correspond to temperature-dependent properties.
I would like to explore whether it is possible to model temperature as a function of these six properties simultaneously, similar to a multiple regression approach. I have previously done this with linear responses, but in this case, the relationships are nonlinear (sigmoidal, Z-shaped).
I considered using a generalized additive model (GAM), but I have no prior experience with this method and may be overlooking a simpler or more suitable approach.
Could anyone provide insights or suggestions on how to best tackle this?
Thanks in advance! :)

Akzeptierte Antwort

Star Strider
Star Strider am 29 Jan. 2025
I am not certain what you want to do.
Fitting a generalized additive model (GAM) for regression using the fitrgam function would go something like this —
T1 = readtable('temp-vs-properties.txt')
T1 = 9x7 table
Var1 Var2 Var3 Var4 Var5 Var6 Var7 ____ _______ _______ _______ _______ _______ _______ 12 10.941 2.2536 1.029 4.8549 10.633 0.45658 25 9.8131 2.2364 1.0215 4.3878 9.6068 0.45674 50 6.7255 2.2287 0.97971 3.0177 6.8649 0.43959 75 3.6134 2.1326 0.88567 1.6944 4.0799 0.4153 100 1.3233 1.7712 0.64251 0.74709 2.0595 0.36275 125 0.51476 1.2776 0.38488 0.40291 1.3374 0.30126 150 0.2727 0.96724 0.24871 0.28194 1.0965 0.25713 175 0.19387 0.85354 0.19718 0.22713 0.98321 0.23101 200 0.16745 0.86259 0.18527 0.19413 0.90385 0.21478
VN = T1.Properties.VariableNames;
figure
plot(T1{:,1}, T1{:,2:end})
grid
xlabel(VN{1})
ylabel('Properties')
legend(VN{2:end}, Location='best')
Mdl = fitrgam(T1, 'Var1')
Mdl =
RegressionGAM PredictorNames: {'Var2' 'Var3' 'Var4' 'Var5' 'Var6' 'Var7'} ResponseName: 'Var1' CategoricalPredictors: [] ResponseTransform: 'none' Intercept: 101.3333 IsStandardDeviationFit: 0 NumObservations: 9
I am not certain that I am plotting your data correctly.
There are other options, such as fitnlm that might be more appropriate, depending on what you want to do.
.
  4 Kommentare
Fernando Maturi
Fernando Maturi am 2 Feb. 2025
That's exactly what I was looking for!
Thanks a lot :)
Star Strider
Star Strider am 2 Feb. 2025
As always, my pleasure!

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Kategorien

Mehr zu Linear and Nonlinear Regression finden Sie in Help Center und File Exchange

Produkte


Version

R2024b

Community Treasure Hunt

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

Start Hunting!

Translated by