3
$\begingroup$

This my result of model fit:

test = {{12.`, 0.2205`, 0}, {24.`, 0.3631`, 0}, {36.`, 0.4696`, 
    0}, {48.`, 0.6112`, 0}, {60.`, 0.7205`, 0}};
fun = NonlinearModelFit[test, k*t^n - d, {n, k}, {t, d}]

enter image description here

We can visualize it

 ListPlot[Most /@ test]~Show~Plot[fun["BestFit"] + d, {t, 12, 60}]

enter image description here

So I think the parametre is very good as the visualization.And we can get the proterty "SinglePredictionErrors" form the FittedModel

fun["SinglePredictionErrors"]

{0.0145981, 0.0141301, 0.0134857, 0.0138039, 0.015592}

But how can I get the "AdjustedRSquared" from FittedModel to measure the result??

enter image description here

$\endgroup$
7
  • $\begingroup$ You may feel this answer interesting. $\endgroup$
    – xzczd
    Dec 26 '15 at 10:13
  • $\begingroup$ @xzczd I'm glad to meet you in SE.Your link help me a lot. $\endgroup$
    – yode
    Dec 26 '15 at 17:50
  • $\begingroup$ Glad to meet you too, and will be more glad if you link this post back to Tieba to avoid redundant works. $\endgroup$
    – xzczd
    Dec 28 '15 at 13:22
  • $\begingroup$ @xzczd But I think the current answerer have misunderstood this question. $\endgroup$
    – yode
    Dec 29 '15 at 10:36
  • $\begingroup$ I don't think so, though not being explicitly claimed, Jim's answer has clearly indicated that, fun@"AdjustedRSquared" returns ComplexInfinity simply because the "AdjustedRSquared" of fun is ComplexInfinity. Anyway, if you think the answerer has misunderstand you, you can just comment under the answer to further discuss with the answerer rather than sit in silence. $\endgroup$
    – xzczd
    Dec 29 '15 at 11:24
4
$\begingroup$

I think your model formulation is a bit odd. All of the dependent variable values are zero which makes the total sum of squares being exactly zero. And that causes the issues with fun["AdjustedRSquared"] not to mention fun["RSquared"] and many of the entries in the summary tables.

If you look at the ANOVA table, you'll see that the pieces that go into the estimate of $R^2$ are not what is desired:

fun["ANOVATable"]

ANOVA table

Here is the model I think you want to fit:

test = {{12.`, 0.2205`}, {24.`, 0.3631`}, {36.`, 0.4696`}, {48.`, 
    0.6112`}, {60.`, 0.7205`}};
fun = NonlinearModelFit[test, k*t^n - d, {n, k, d}, {t}]
fun["AdjustedRSquared"]
(* 0.99948 *)
Show[ListPlot[test], Plot[fun[t], {t, 12, 60}], Frame -> True]

Predictions

However, unless this is just a small sample of your data, attempting to fit 4 parameters (n, k, d, and error variance) with just 5 data points is not going to get you very precise estimates of any of the parameters despite the visual appearance of the fit.

$\endgroup$
1
  • $\begingroup$ I'm so sorry for I miss in what is nonlinear regressions.And I think NonlinearModelFit[test, k*t^n - d, {n, k}, {t}] is what I want.All the same thanks for you concern this problem.Actually I should delete this foolish question but it's include your response.So I vote it up for your help but have not accept it to be a answer in case of misleading the reader. $\endgroup$
    – yode
    Dec 31 '15 at 12:57

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.