Should a new user just default to LinearModelFit (vs Fit)Difference between Fitting AlgorithmsFunctionalize...

How is this property called for mod?

Allow console draw poker game to output more hands

Writing dialogues for characters whose first language is not English

Boss asked me to sign a resignation paper without a date on it along with my new contract

Are all power cords made equal?

Renting a 2CV in France

What are some ways of extending a description of a scenery?

Does diversity provide anything that meritocracy does not?

Is the fingering of thirds flexible or do I have to follow the rules?

Why didn't Tom Riddle take the presence of Fawkes and the Sorting Hat as more of a threat?

Concatenating two int[]

Single-row INSERT...SELECT much slower than separate SELECT

What can I do to encourage my players to use their consumables?

Is it possible to rotate the Isolines on a Surface Using `MeshFunction`?

Can you determine if focus is sharp without diopter adjustment if your sight is imperfect?

How to not let the Identify spell spoil everything?

How can I prevent an oracle who can see into the past from knowing everything that has happened?

A fantasy book with seven white haired women on the cover

Eww, those bytes are gross

Does the ditching switch allow an A320 to float indefinitely?

Is there a non-trivial covering of the Klein bottle by the Klein bottle?

Buying a "Used" Router

Are the positive and negative planes inner or outer planes?

Why did Ylvis use "go" instead of "say" in phrases like "Dog goes 'woof'"?



Should a new user just default to LinearModelFit (vs Fit)


Difference between Fitting AlgorithmsFunctionalize fitTrying to fit an unknown extreme distributionModule in numerical model for NonlinearModelFit is slow and leaks memoryFit linear data with weights for y and x in LinearModelFitProblem fitting when some data is missingLinearModelFit gives bad fit for simple data setcalculate new table from values of old table and find fit model curveUnusual memory usage in LinearModelFit in version 11.1Increasing the accuracy of the fit when using LinearModelFitNew issue or new setting(s) of Goodness-of-Fit Tests in 11.3@student editionCreating a new list made up by just a particular coordinate of each point in a given set













5












$begingroup$


I tried searching but the noise in the responses is high due to 'fit' being both a function and a valid term.



If I'm new to Mathematica should I just default to LinearModelFit (v7) and recognise Fit as a v1 version that got superceded?



My instinct is 'yes' but wondered if there were valid use cases where Fit would be preferred over LinearModelFit.










share|improve this question









$endgroup$








  • 3




    $begingroup$
    You may want to take a look at mathematica.stackexchange.com/questions/182053/… for an example of some of the usage differences. LinearModelFit generates a model object which has some useful properties (e.g. "RSquared"), in addition to the fit itself. In short, I'd only recommend Fit if you just want the shortest code for getting the linear fit expression without any other baggage.
    $endgroup$
    – eyorble
    15 hours ago












  • $begingroup$
    thx, if i'd found that i wouldn't have asked.
    $endgroup$
    – Joe
    14 hours ago






  • 3




    $begingroup$
    See also Difference between fitting algorithms
    $endgroup$
    – MarcoB
    10 hours ago






  • 1




    $begingroup$
    Possible duplicate of Difference between Fitting Algorithms
    $endgroup$
    – Henrik Schumacher
    2 hours ago
















5












$begingroup$


I tried searching but the noise in the responses is high due to 'fit' being both a function and a valid term.



If I'm new to Mathematica should I just default to LinearModelFit (v7) and recognise Fit as a v1 version that got superceded?



My instinct is 'yes' but wondered if there were valid use cases where Fit would be preferred over LinearModelFit.










share|improve this question









$endgroup$








  • 3




    $begingroup$
    You may want to take a look at mathematica.stackexchange.com/questions/182053/… for an example of some of the usage differences. LinearModelFit generates a model object which has some useful properties (e.g. "RSquared"), in addition to the fit itself. In short, I'd only recommend Fit if you just want the shortest code for getting the linear fit expression without any other baggage.
    $endgroup$
    – eyorble
    15 hours ago












  • $begingroup$
    thx, if i'd found that i wouldn't have asked.
    $endgroup$
    – Joe
    14 hours ago






  • 3




    $begingroup$
    See also Difference between fitting algorithms
    $endgroup$
    – MarcoB
    10 hours ago






  • 1




    $begingroup$
    Possible duplicate of Difference between Fitting Algorithms
    $endgroup$
    – Henrik Schumacher
    2 hours ago














5












5








5





$begingroup$


I tried searching but the noise in the responses is high due to 'fit' being both a function and a valid term.



If I'm new to Mathematica should I just default to LinearModelFit (v7) and recognise Fit as a v1 version that got superceded?



My instinct is 'yes' but wondered if there were valid use cases where Fit would be preferred over LinearModelFit.










share|improve this question









$endgroup$




I tried searching but the noise in the responses is high due to 'fit' being both a function and a valid term.



If I'm new to Mathematica should I just default to LinearModelFit (v7) and recognise Fit as a v1 version that got superceded?



My instinct is 'yes' but wondered if there were valid use cases where Fit would be preferred over LinearModelFit.







fitting






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked 15 hours ago









JoeJoe

687213




687213








  • 3




    $begingroup$
    You may want to take a look at mathematica.stackexchange.com/questions/182053/… for an example of some of the usage differences. LinearModelFit generates a model object which has some useful properties (e.g. "RSquared"), in addition to the fit itself. In short, I'd only recommend Fit if you just want the shortest code for getting the linear fit expression without any other baggage.
    $endgroup$
    – eyorble
    15 hours ago












  • $begingroup$
    thx, if i'd found that i wouldn't have asked.
    $endgroup$
    – Joe
    14 hours ago






  • 3




    $begingroup$
    See also Difference between fitting algorithms
    $endgroup$
    – MarcoB
    10 hours ago






  • 1




    $begingroup$
    Possible duplicate of Difference between Fitting Algorithms
    $endgroup$
    – Henrik Schumacher
    2 hours ago














  • 3




    $begingroup$
    You may want to take a look at mathematica.stackexchange.com/questions/182053/… for an example of some of the usage differences. LinearModelFit generates a model object which has some useful properties (e.g. "RSquared"), in addition to the fit itself. In short, I'd only recommend Fit if you just want the shortest code for getting the linear fit expression without any other baggage.
    $endgroup$
    – eyorble
    15 hours ago












  • $begingroup$
    thx, if i'd found that i wouldn't have asked.
    $endgroup$
    – Joe
    14 hours ago






  • 3




    $begingroup$
    See also Difference between fitting algorithms
    $endgroup$
    – MarcoB
    10 hours ago






  • 1




    $begingroup$
    Possible duplicate of Difference between Fitting Algorithms
    $endgroup$
    – Henrik Schumacher
    2 hours ago








3




3




$begingroup$
You may want to take a look at mathematica.stackexchange.com/questions/182053/… for an example of some of the usage differences. LinearModelFit generates a model object which has some useful properties (e.g. "RSquared"), in addition to the fit itself. In short, I'd only recommend Fit if you just want the shortest code for getting the linear fit expression without any other baggage.
$endgroup$
– eyorble
15 hours ago






$begingroup$
You may want to take a look at mathematica.stackexchange.com/questions/182053/… for an example of some of the usage differences. LinearModelFit generates a model object which has some useful properties (e.g. "RSquared"), in addition to the fit itself. In short, I'd only recommend Fit if you just want the shortest code for getting the linear fit expression without any other baggage.
$endgroup$
– eyorble
15 hours ago














$begingroup$
thx, if i'd found that i wouldn't have asked.
$endgroup$
– Joe
14 hours ago




$begingroup$
thx, if i'd found that i wouldn't have asked.
$endgroup$
– Joe
14 hours ago




3




3




$begingroup$
See also Difference between fitting algorithms
$endgroup$
– MarcoB
10 hours ago




$begingroup$
See also Difference between fitting algorithms
$endgroup$
– MarcoB
10 hours ago




1




1




$begingroup$
Possible duplicate of Difference between Fitting Algorithms
$endgroup$
– Henrik Schumacher
2 hours ago




$begingroup$
Possible duplicate of Difference between Fitting Algorithms
$endgroup$
– Henrik Schumacher
2 hours ago










1 Answer
1






active

oldest

votes


















12












$begingroup$

There are a few major differences between Fit and LinearModelFit.



LinearModelFit generates a full model object as its output, which maintains a large set of interesting properties (such as RSquared or ANOVATable). These can be accessed by:



lmf = LinearModelFit[{2, 3, 4, 5}, {x}, x];
lmf["Properties"]
lmf["RSquared"]


By default, LinearModelFit assumes that the zero-intercept may be non-zero. This property is controlled by the IncludeConstantBasis option. LinearModelFit has several interesting but advanced options available as well, such as the ability to define weights and perform error propagation through the model.



The final fit expression from LinearModelFit can be extracted with Normal.



Fit does not assume a constant basis, and returns the fit expression directly. It does not calculate additional properties, will automatically convert exact numbers to machine precision, and only finds the least-squares fit. LinearModelFit and Fit can work at arbitrary precision (as unlikely as that may be to be useful), but only LinearModelFit allows the specification of WorkingPrecision as an option.



The primary advantage of Fit would appear to be its simplicity and brevity. If you only need the least-squares fit expression or are doing code-golf, Fit should suffice. In most other cases, I would recommend using LinearModelFit, if only to be able to access the various quality measures it can calculate on the side.



Note, however, that I wouldn't expect either function to have significant errors -- they ultimately should find the same model, assuming that the constant basis is either included or excluded in both, and that no special options are specified in LinearModelFit to adapt the model to a specific use case. It's just a question of if you want/need the additional data of the model object.






share|improve this answer









$endgroup$













  • $begingroup$
    I believe LinearModelFit uses Fit behind the scenes (not sure).
    $endgroup$
    – Szabolcs
    5 hours ago






  • 1




    $begingroup$
    @Szabolcs I just spent a few minutes PrintDefinitionsing LinearModelFit and didn't see any usage of Fit specifically.
    $endgroup$
    – Carl Lange
    5 hours ago













Your Answer





StackExchange.ifUsing("editor", function () {
return StackExchange.using("mathjaxEditing", function () {
StackExchange.MarkdownEditor.creationCallbacks.add(function (editor, postfix) {
StackExchange.mathjaxEditing.prepareWmdForMathJax(editor, postfix, [["$", "$"], ["\\(","\\)"]]);
});
});
}, "mathjax-editing");

StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "387"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});

function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});


}
});














draft saved

draft discarded


















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmathematica.stackexchange.com%2fquestions%2f192147%2fshould-a-new-user-just-default-to-linearmodelfit-vs-fit%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown

























1 Answer
1






active

oldest

votes








1 Answer
1






active

oldest

votes









active

oldest

votes






active

oldest

votes









12












$begingroup$

There are a few major differences between Fit and LinearModelFit.



LinearModelFit generates a full model object as its output, which maintains a large set of interesting properties (such as RSquared or ANOVATable). These can be accessed by:



lmf = LinearModelFit[{2, 3, 4, 5}, {x}, x];
lmf["Properties"]
lmf["RSquared"]


By default, LinearModelFit assumes that the zero-intercept may be non-zero. This property is controlled by the IncludeConstantBasis option. LinearModelFit has several interesting but advanced options available as well, such as the ability to define weights and perform error propagation through the model.



The final fit expression from LinearModelFit can be extracted with Normal.



Fit does not assume a constant basis, and returns the fit expression directly. It does not calculate additional properties, will automatically convert exact numbers to machine precision, and only finds the least-squares fit. LinearModelFit and Fit can work at arbitrary precision (as unlikely as that may be to be useful), but only LinearModelFit allows the specification of WorkingPrecision as an option.



The primary advantage of Fit would appear to be its simplicity and brevity. If you only need the least-squares fit expression or are doing code-golf, Fit should suffice. In most other cases, I would recommend using LinearModelFit, if only to be able to access the various quality measures it can calculate on the side.



Note, however, that I wouldn't expect either function to have significant errors -- they ultimately should find the same model, assuming that the constant basis is either included or excluded in both, and that no special options are specified in LinearModelFit to adapt the model to a specific use case. It's just a question of if you want/need the additional data of the model object.






share|improve this answer









$endgroup$













  • $begingroup$
    I believe LinearModelFit uses Fit behind the scenes (not sure).
    $endgroup$
    – Szabolcs
    5 hours ago






  • 1




    $begingroup$
    @Szabolcs I just spent a few minutes PrintDefinitionsing LinearModelFit and didn't see any usage of Fit specifically.
    $endgroup$
    – Carl Lange
    5 hours ago


















12












$begingroup$

There are a few major differences between Fit and LinearModelFit.



LinearModelFit generates a full model object as its output, which maintains a large set of interesting properties (such as RSquared or ANOVATable). These can be accessed by:



lmf = LinearModelFit[{2, 3, 4, 5}, {x}, x];
lmf["Properties"]
lmf["RSquared"]


By default, LinearModelFit assumes that the zero-intercept may be non-zero. This property is controlled by the IncludeConstantBasis option. LinearModelFit has several interesting but advanced options available as well, such as the ability to define weights and perform error propagation through the model.



The final fit expression from LinearModelFit can be extracted with Normal.



Fit does not assume a constant basis, and returns the fit expression directly. It does not calculate additional properties, will automatically convert exact numbers to machine precision, and only finds the least-squares fit. LinearModelFit and Fit can work at arbitrary precision (as unlikely as that may be to be useful), but only LinearModelFit allows the specification of WorkingPrecision as an option.



The primary advantage of Fit would appear to be its simplicity and brevity. If you only need the least-squares fit expression or are doing code-golf, Fit should suffice. In most other cases, I would recommend using LinearModelFit, if only to be able to access the various quality measures it can calculate on the side.



Note, however, that I wouldn't expect either function to have significant errors -- they ultimately should find the same model, assuming that the constant basis is either included or excluded in both, and that no special options are specified in LinearModelFit to adapt the model to a specific use case. It's just a question of if you want/need the additional data of the model object.






share|improve this answer









$endgroup$













  • $begingroup$
    I believe LinearModelFit uses Fit behind the scenes (not sure).
    $endgroup$
    – Szabolcs
    5 hours ago






  • 1




    $begingroup$
    @Szabolcs I just spent a few minutes PrintDefinitionsing LinearModelFit and didn't see any usage of Fit specifically.
    $endgroup$
    – Carl Lange
    5 hours ago
















12












12








12





$begingroup$

There are a few major differences between Fit and LinearModelFit.



LinearModelFit generates a full model object as its output, which maintains a large set of interesting properties (such as RSquared or ANOVATable). These can be accessed by:



lmf = LinearModelFit[{2, 3, 4, 5}, {x}, x];
lmf["Properties"]
lmf["RSquared"]


By default, LinearModelFit assumes that the zero-intercept may be non-zero. This property is controlled by the IncludeConstantBasis option. LinearModelFit has several interesting but advanced options available as well, such as the ability to define weights and perform error propagation through the model.



The final fit expression from LinearModelFit can be extracted with Normal.



Fit does not assume a constant basis, and returns the fit expression directly. It does not calculate additional properties, will automatically convert exact numbers to machine precision, and only finds the least-squares fit. LinearModelFit and Fit can work at arbitrary precision (as unlikely as that may be to be useful), but only LinearModelFit allows the specification of WorkingPrecision as an option.



The primary advantage of Fit would appear to be its simplicity and brevity. If you only need the least-squares fit expression or are doing code-golf, Fit should suffice. In most other cases, I would recommend using LinearModelFit, if only to be able to access the various quality measures it can calculate on the side.



Note, however, that I wouldn't expect either function to have significant errors -- they ultimately should find the same model, assuming that the constant basis is either included or excluded in both, and that no special options are specified in LinearModelFit to adapt the model to a specific use case. It's just a question of if you want/need the additional data of the model object.






share|improve this answer









$endgroup$



There are a few major differences between Fit and LinearModelFit.



LinearModelFit generates a full model object as its output, which maintains a large set of interesting properties (such as RSquared or ANOVATable). These can be accessed by:



lmf = LinearModelFit[{2, 3, 4, 5}, {x}, x];
lmf["Properties"]
lmf["RSquared"]


By default, LinearModelFit assumes that the zero-intercept may be non-zero. This property is controlled by the IncludeConstantBasis option. LinearModelFit has several interesting but advanced options available as well, such as the ability to define weights and perform error propagation through the model.



The final fit expression from LinearModelFit can be extracted with Normal.



Fit does not assume a constant basis, and returns the fit expression directly. It does not calculate additional properties, will automatically convert exact numbers to machine precision, and only finds the least-squares fit. LinearModelFit and Fit can work at arbitrary precision (as unlikely as that may be to be useful), but only LinearModelFit allows the specification of WorkingPrecision as an option.



The primary advantage of Fit would appear to be its simplicity and brevity. If you only need the least-squares fit expression or are doing code-golf, Fit should suffice. In most other cases, I would recommend using LinearModelFit, if only to be able to access the various quality measures it can calculate on the side.



Note, however, that I wouldn't expect either function to have significant errors -- they ultimately should find the same model, assuming that the constant basis is either included or excluded in both, and that no special options are specified in LinearModelFit to adapt the model to a specific use case. It's just a question of if you want/need the additional data of the model object.







share|improve this answer












share|improve this answer



share|improve this answer










answered 15 hours ago









eyorbleeyorble

5,61311028




5,61311028












  • $begingroup$
    I believe LinearModelFit uses Fit behind the scenes (not sure).
    $endgroup$
    – Szabolcs
    5 hours ago






  • 1




    $begingroup$
    @Szabolcs I just spent a few minutes PrintDefinitionsing LinearModelFit and didn't see any usage of Fit specifically.
    $endgroup$
    – Carl Lange
    5 hours ago




















  • $begingroup$
    I believe LinearModelFit uses Fit behind the scenes (not sure).
    $endgroup$
    – Szabolcs
    5 hours ago






  • 1




    $begingroup$
    @Szabolcs I just spent a few minutes PrintDefinitionsing LinearModelFit and didn't see any usage of Fit specifically.
    $endgroup$
    – Carl Lange
    5 hours ago


















$begingroup$
I believe LinearModelFit uses Fit behind the scenes (not sure).
$endgroup$
– Szabolcs
5 hours ago




$begingroup$
I believe LinearModelFit uses Fit behind the scenes (not sure).
$endgroup$
– Szabolcs
5 hours ago




1




1




$begingroup$
@Szabolcs I just spent a few minutes PrintDefinitionsing LinearModelFit and didn't see any usage of Fit specifically.
$endgroup$
– Carl Lange
5 hours ago






$begingroup$
@Szabolcs I just spent a few minutes PrintDefinitionsing LinearModelFit and didn't see any usage of Fit specifically.
$endgroup$
– Carl Lange
5 hours ago




















draft saved

draft discarded




















































Thanks for contributing an answer to Mathematica Stack Exchange!


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


Use MathJax to format equations. MathJax reference.


To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmathematica.stackexchange.com%2fquestions%2f192147%2fshould-a-new-user-just-default-to-linearmodelfit-vs-fit%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

Why not use the yoke to control yaw, as well as pitch and roll? Announcing the arrival of...

Couldn't open a raw socket. Error: Permission denied (13) (nmap)Is it possible to run networking commands...

VNC viewer RFB protocol error: bad desktop size 0x0I Cannot Type the Key 'd' (lowercase) in VNC Viewer...