Properties of an arbitrary (i.e., not fitted) statistical model
Clash Royale CLAN TAG#URR8PPP
Suppose that I have a data
and a statistical model that is not the result of fitting, but has a different origin. For example, I have a list of measurements and a theoretical model whose predicting accuracy I want to assess.
Is there a simple way to obtain all the properties of a FittedModel
object, but from my theoretical model?
For example, suppose that
mt=Table[i,1+i+RandomReal,i,5]
yields mt=1,2.56508,2,3.58291,3,4.8005,4,5.24265,5,6.38087
If I call
LinearModelFit[mt,x,x]
I get
And I can then get R$^2$ for the adjusted model:
%["RSquared"]
which gives $0.9851$.
But I know the theoretical model is $1.5+x$. Can I have the power of a FittedModel (residuals, ANOVA, RSquared, etc.) for my non-fitted model?
probability-or-statistics fitting
add a comment |
Suppose that I have a data
and a statistical model that is not the result of fitting, but has a different origin. For example, I have a list of measurements and a theoretical model whose predicting accuracy I want to assess.
Is there a simple way to obtain all the properties of a FittedModel
object, but from my theoretical model?
For example, suppose that
mt=Table[i,1+i+RandomReal,i,5]
yields mt=1,2.56508,2,3.58291,3,4.8005,4,5.24265,5,6.38087
If I call
LinearModelFit[mt,x,x]
I get
And I can then get R$^2$ for the adjusted model:
%["RSquared"]
which gives $0.9851$.
But I know the theoretical model is $1.5+x$. Can I have the power of a FittedModel (residuals, ANOVA, RSquared, etc.) for my non-fitted model?
probability-or-statistics fitting
If you look atFullForm[LinearModelFit[mt,x,x]]
from your example above then the internal structure seems reasonably simple and understandable. What happens if you carefully build aFittedModel
using that structure as an example, not by doing a fit but by substituting your theoretical model in that and then you query that constructedFittedModel
for residuals, ANOVA, etc? Can you do this on test cases where you know what the calculations should show to verify that this is being done correctly?
– Bill
Dec 21 '18 at 22:04
add a comment |
Suppose that I have a data
and a statistical model that is not the result of fitting, but has a different origin. For example, I have a list of measurements and a theoretical model whose predicting accuracy I want to assess.
Is there a simple way to obtain all the properties of a FittedModel
object, but from my theoretical model?
For example, suppose that
mt=Table[i,1+i+RandomReal,i,5]
yields mt=1,2.56508,2,3.58291,3,4.8005,4,5.24265,5,6.38087
If I call
LinearModelFit[mt,x,x]
I get
And I can then get R$^2$ for the adjusted model:
%["RSquared"]
which gives $0.9851$.
But I know the theoretical model is $1.5+x$. Can I have the power of a FittedModel (residuals, ANOVA, RSquared, etc.) for my non-fitted model?
probability-or-statistics fitting
Suppose that I have a data
and a statistical model that is not the result of fitting, but has a different origin. For example, I have a list of measurements and a theoretical model whose predicting accuracy I want to assess.
Is there a simple way to obtain all the properties of a FittedModel
object, but from my theoretical model?
For example, suppose that
mt=Table[i,1+i+RandomReal,i,5]
yields mt=1,2.56508,2,3.58291,3,4.8005,4,5.24265,5,6.38087
If I call
LinearModelFit[mt,x,x]
I get
And I can then get R$^2$ for the adjusted model:
%["RSquared"]
which gives $0.9851$.
But I know the theoretical model is $1.5+x$. Can I have the power of a FittedModel (residuals, ANOVA, RSquared, etc.) for my non-fitted model?
probability-or-statistics fitting
probability-or-statistics fitting
edited Dec 22 '18 at 17:00
Michael E2
145k11195464
145k11195464
asked Dec 21 '18 at 18:17
Rafael
18329
18329
If you look atFullForm[LinearModelFit[mt,x,x]]
from your example above then the internal structure seems reasonably simple and understandable. What happens if you carefully build aFittedModel
using that structure as an example, not by doing a fit but by substituting your theoretical model in that and then you query that constructedFittedModel
for residuals, ANOVA, etc? Can you do this on test cases where you know what the calculations should show to verify that this is being done correctly?
– Bill
Dec 21 '18 at 22:04
add a comment |
If you look atFullForm[LinearModelFit[mt,x,x]]
from your example above then the internal structure seems reasonably simple and understandable. What happens if you carefully build aFittedModel
using that structure as an example, not by doing a fit but by substituting your theoretical model in that and then you query that constructedFittedModel
for residuals, ANOVA, etc? Can you do this on test cases where you know what the calculations should show to verify that this is being done correctly?
– Bill
Dec 21 '18 at 22:04
If you look at
FullForm[LinearModelFit[mt,x,x]]
from your example above then the internal structure seems reasonably simple and understandable. What happens if you carefully build a FittedModel
using that structure as an example, not by doing a fit but by substituting your theoretical model in that and then you query that constructed FittedModel
for residuals, ANOVA, etc? Can you do this on test cases where you know what the calculations should show to verify that this is being done correctly?– Bill
Dec 21 '18 at 22:04
If you look at
FullForm[LinearModelFit[mt,x,x]]
from your example above then the internal structure seems reasonably simple and understandable. What happens if you carefully build a FittedModel
using that structure as an example, not by doing a fit but by substituting your theoretical model in that and then you query that constructed FittedModel
for residuals, ANOVA, etc? Can you do this on test cases where you know what the calculations should show to verify that this is being done correctly?– Bill
Dec 21 '18 at 22:04
add a comment |
1 Answer
1
active
oldest
votes
You can use NonlinearModelFit
but not all output options will either be appropriate and some will require "adjustment".
All of the fitting procedures want to estimate parameters (that's what they're made for) so NonlinearModelFit
can be tricked by included a parameter that isn't in the model. Here I used a parameter named a
:
SeedRandom[12345];
mt = Table[i, 1 + i + RandomReal, i, 5]
nlm = NonlinearModelFit[mt, 1.5 + x, a, x]
So the following work fine with no adjustment needed:
nlm["FitResiduals"]
(* -0.378754, -0.170078, 0.282753, -0.0698316, -0.276414 *)
nlm["PredictedResponse"]
(* 2.5, 3.5, 4.5, 5.5, 6.5 *)
The "EstimatedVariance" needs adjustment:
Mean[(mt[[All, 2]] - 1.5 - mt[[All, 1]])^2]
(* 0.0667223 *)
n = Length[mt];
nlm["EstimatedVariance"] (n - 1)/n
(* 0.0667223 *)
Nice! You get some information on the dummy model/parametera
(in the ANOVA, ParameterTable, etc.), is it possible to get such information for my coefficients (i.e., 1.5 and 1)? Or is all that kind of information just meaningless for a non-fitted model?
– Rafael
Dec 21 '18 at 19:55
2
Yes, I'd vote for meaningless. I'd also avoid any option that starts with"Parameter..."
as the residual variance is the only parameter estimated.
– JimB
Dec 21 '18 at 20:14
add a comment |
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
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmathematica.stackexchange.com%2fquestions%2f188290%2fproperties-of-an-arbitrary-i-e-not-fitted-statistical-model%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
You can use NonlinearModelFit
but not all output options will either be appropriate and some will require "adjustment".
All of the fitting procedures want to estimate parameters (that's what they're made for) so NonlinearModelFit
can be tricked by included a parameter that isn't in the model. Here I used a parameter named a
:
SeedRandom[12345];
mt = Table[i, 1 + i + RandomReal, i, 5]
nlm = NonlinearModelFit[mt, 1.5 + x, a, x]
So the following work fine with no adjustment needed:
nlm["FitResiduals"]
(* -0.378754, -0.170078, 0.282753, -0.0698316, -0.276414 *)
nlm["PredictedResponse"]
(* 2.5, 3.5, 4.5, 5.5, 6.5 *)
The "EstimatedVariance" needs adjustment:
Mean[(mt[[All, 2]] - 1.5 - mt[[All, 1]])^2]
(* 0.0667223 *)
n = Length[mt];
nlm["EstimatedVariance"] (n - 1)/n
(* 0.0667223 *)
Nice! You get some information on the dummy model/parametera
(in the ANOVA, ParameterTable, etc.), is it possible to get such information for my coefficients (i.e., 1.5 and 1)? Or is all that kind of information just meaningless for a non-fitted model?
– Rafael
Dec 21 '18 at 19:55
2
Yes, I'd vote for meaningless. I'd also avoid any option that starts with"Parameter..."
as the residual variance is the only parameter estimated.
– JimB
Dec 21 '18 at 20:14
add a comment |
You can use NonlinearModelFit
but not all output options will either be appropriate and some will require "adjustment".
All of the fitting procedures want to estimate parameters (that's what they're made for) so NonlinearModelFit
can be tricked by included a parameter that isn't in the model. Here I used a parameter named a
:
SeedRandom[12345];
mt = Table[i, 1 + i + RandomReal, i, 5]
nlm = NonlinearModelFit[mt, 1.5 + x, a, x]
So the following work fine with no adjustment needed:
nlm["FitResiduals"]
(* -0.378754, -0.170078, 0.282753, -0.0698316, -0.276414 *)
nlm["PredictedResponse"]
(* 2.5, 3.5, 4.5, 5.5, 6.5 *)
The "EstimatedVariance" needs adjustment:
Mean[(mt[[All, 2]] - 1.5 - mt[[All, 1]])^2]
(* 0.0667223 *)
n = Length[mt];
nlm["EstimatedVariance"] (n - 1)/n
(* 0.0667223 *)
Nice! You get some information on the dummy model/parametera
(in the ANOVA, ParameterTable, etc.), is it possible to get such information for my coefficients (i.e., 1.5 and 1)? Or is all that kind of information just meaningless for a non-fitted model?
– Rafael
Dec 21 '18 at 19:55
2
Yes, I'd vote for meaningless. I'd also avoid any option that starts with"Parameter..."
as the residual variance is the only parameter estimated.
– JimB
Dec 21 '18 at 20:14
add a comment |
You can use NonlinearModelFit
but not all output options will either be appropriate and some will require "adjustment".
All of the fitting procedures want to estimate parameters (that's what they're made for) so NonlinearModelFit
can be tricked by included a parameter that isn't in the model. Here I used a parameter named a
:
SeedRandom[12345];
mt = Table[i, 1 + i + RandomReal, i, 5]
nlm = NonlinearModelFit[mt, 1.5 + x, a, x]
So the following work fine with no adjustment needed:
nlm["FitResiduals"]
(* -0.378754, -0.170078, 0.282753, -0.0698316, -0.276414 *)
nlm["PredictedResponse"]
(* 2.5, 3.5, 4.5, 5.5, 6.5 *)
The "EstimatedVariance" needs adjustment:
Mean[(mt[[All, 2]] - 1.5 - mt[[All, 1]])^2]
(* 0.0667223 *)
n = Length[mt];
nlm["EstimatedVariance"] (n - 1)/n
(* 0.0667223 *)
You can use NonlinearModelFit
but not all output options will either be appropriate and some will require "adjustment".
All of the fitting procedures want to estimate parameters (that's what they're made for) so NonlinearModelFit
can be tricked by included a parameter that isn't in the model. Here I used a parameter named a
:
SeedRandom[12345];
mt = Table[i, 1 + i + RandomReal, i, 5]
nlm = NonlinearModelFit[mt, 1.5 + x, a, x]
So the following work fine with no adjustment needed:
nlm["FitResiduals"]
(* -0.378754, -0.170078, 0.282753, -0.0698316, -0.276414 *)
nlm["PredictedResponse"]
(* 2.5, 3.5, 4.5, 5.5, 6.5 *)
The "EstimatedVariance" needs adjustment:
Mean[(mt[[All, 2]] - 1.5 - mt[[All, 1]])^2]
(* 0.0667223 *)
n = Length[mt];
nlm["EstimatedVariance"] (n - 1)/n
(* 0.0667223 *)
answered Dec 21 '18 at 19:28
JimB
16.9k12662
16.9k12662
Nice! You get some information on the dummy model/parametera
(in the ANOVA, ParameterTable, etc.), is it possible to get such information for my coefficients (i.e., 1.5 and 1)? Or is all that kind of information just meaningless for a non-fitted model?
– Rafael
Dec 21 '18 at 19:55
2
Yes, I'd vote for meaningless. I'd also avoid any option that starts with"Parameter..."
as the residual variance is the only parameter estimated.
– JimB
Dec 21 '18 at 20:14
add a comment |
Nice! You get some information on the dummy model/parametera
(in the ANOVA, ParameterTable, etc.), is it possible to get such information for my coefficients (i.e., 1.5 and 1)? Or is all that kind of information just meaningless for a non-fitted model?
– Rafael
Dec 21 '18 at 19:55
2
Yes, I'd vote for meaningless. I'd also avoid any option that starts with"Parameter..."
as the residual variance is the only parameter estimated.
– JimB
Dec 21 '18 at 20:14
Nice! You get some information on the dummy model/parameter
a
(in the ANOVA, ParameterTable, etc.), is it possible to get such information for my coefficients (i.e., 1.5 and 1)? Or is all that kind of information just meaningless for a non-fitted model?– Rafael
Dec 21 '18 at 19:55
Nice! You get some information on the dummy model/parameter
a
(in the ANOVA, ParameterTable, etc.), is it possible to get such information for my coefficients (i.e., 1.5 and 1)? Or is all that kind of information just meaningless for a non-fitted model?– Rafael
Dec 21 '18 at 19:55
2
2
Yes, I'd vote for meaningless. I'd also avoid any option that starts with
"Parameter..."
as the residual variance is the only parameter estimated.– JimB
Dec 21 '18 at 20:14
Yes, I'd vote for meaningless. I'd also avoid any option that starts with
"Parameter..."
as the residual variance is the only parameter estimated.– JimB
Dec 21 '18 at 20:14
add a comment |
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.
Some of your past answers have not been well-received, and you're in danger of being blocked from answering.
Please pay close attention to the following guidance:
- 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.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmathematica.stackexchange.com%2fquestions%2f188290%2fproperties-of-an-arbitrary-i-e-not-fitted-statistical-model%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
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
If you look at
FullForm[LinearModelFit[mt,x,x]]
from your example above then the internal structure seems reasonably simple and understandable. What happens if you carefully build aFittedModel
using that structure as an example, not by doing a fit but by substituting your theoretical model in that and then you query that constructedFittedModel
for residuals, ANOVA, etc? Can you do this on test cases where you know what the calculations should show to verify that this is being done correctly?– Bill
Dec 21 '18 at 22:04