-
Notifications
You must be signed in to change notification settings - Fork 924
-
Hello community,
I have been trying to figure out how to obtain the regression equation for a linear regression model with a pre-defined intercept value with no success.
The customer want to replicate some of the Excel functionalities that they are used to use in Excel. Is this even possible in with this lib?
Thank you.
Beta Was this translation helpful? Give feedback.
All reactions
You can apply y - 3.0 to the FitThroughOrigin function to model the equation with an intercept of 3 on the y-axis.
Replies: 2 comments 4 replies
-
I know that there is a built-in function to FitThroughOrigin, but what if I want to model the equation to intercept (a=xyz) on Y=3?
Beta Was this translation helpful? Give feedback.
All reactions
-
You can apply y - 3.0 to the FitThroughOrigin function to model the equation with an intercept of 3 on the y-axis.
Beta Was this translation helpful? Give feedback.
All reactions
-
👍 1
-
Ok, so far that seems to do the trick!
Is there any similar function as FitThroughOrigin for exponential and polynomial models?
Beta Was this translation helpful? Give feedback.
All reactions
-
var slope = FitThroughOrigin(x, y.Select(p => p - 3.0).ToArray())
Beta Was this translation helpful? Give feedback.
All reactions
-
👍 1
-
Please see mathnet-numerics/src/Numerics/Fit.cs.
For general models, nonlinear least square fitting (Levenberg-Marquardt) or other optimization methods can be used. Please see the test cases in mathnet-numerics/src/Numerics.Tests/OptimizationTests.
Beta Was this translation helpful? Give feedback.
All reactions
-
I'll give it a look. Thank you.
Beta Was this translation helpful? Give feedback.