2
$\begingroup$

I obtained the fitted model from the image using the following code:

kguess = 3;
nguess = 1;
data = {{0.010000000000000004`, 0.`}, {0.029999999999999995`, 
    0.1835304721030043`}, {0.10000000000000002`, 
    0.49498712446351933`}, {0.3`, 
    0.8998025751072961`}, {10.000000000000002`, 
    0.9641931330472102`}, {100.00000000000004`, 
    1.0063948497854078`}, {10.000000000000002`, 
    1.0244935622317597`}, {30.000000000000004`, 
    1.0407467811158797`}, {10.000000000000002`, 
    1.0478068669527896`}, {999.9999999999998`, 
    1.0515150214592275`}, {30.000000000000004`, 
    1.0598712446351932`}, {30.000000000000004`, 
    1.0602017167381972`}, {299.99999999999994`, 
    1.067`}, {999.9999999999998`, 1.069420600858369`}, {1.`, 
    1.0807639484978542`}, {100.00000000000004`, 
    1.0938369098712446`}, {3.0000000000000004`, 
    1.1059270386266093`}, {299.99999999999994`, 
    1.107145922746781`}, {2999.9999999999977`, 
    1.1216223175965667`}, {10000.00000000001`, 
    1.1313605150214594`}, {100.00000000000004`, 
    1.1466051502145922`}, {299.99999999999994`, 
    1.1504721030042917`}, {999.9999999999998`, 1.171429184549356`}};

nlm = NonlinearModelFit[data, (1 - Exp[-k*((t)^n)])*dhnematicmax, {{k, kguess}, {n, nguess}}, t]

model

If I know that the variable k(which is equal to 3.90743 in this example) from the fitted model is equal to k = kref*Exp[(-E/8.314)*((1/360.15) - (1/353.15))];. How can I find the unknown variables kref and Ein Mathematica using NonlinearModelFit or any other function?

$\endgroup$
4
  • $\begingroup$ You can estimate k but not kref and E. (Note that E is a reserved word and you should avoid uppercase letters for variables in Mathematica. Also dhnematicmax is not defined but I suspect has a value of 1.2.) Suppose k = a + b. Just knowing k there is an infinite set of values of a and b that satisfy k = a + b. $\endgroup$
    – JimB
    Commented Apr 30, 2020 at 0:23
  • $\begingroup$ @JimB I was thinking that perhaps it could be use something like: nlm = NonlinearModelFit[data,(1 - Exp[-kref*Exp[(-e/8.314)*((1/360.15) - (1/353.15))]*((t)^n)])*1.2, {{kref, krefguess}, {e, eguess}}, t]. In other words, simply replacing k by kref*Exp[(-E/8.314)*((1/360.15) - (1/353.15))].(I now change "E" as "e") $\endgroup$
    – John
    Commented Apr 30, 2020 at 0:51
  • $\begingroup$ What happened when you did that? $\endgroup$
    – JimB
    Commented Apr 30, 2020 at 1:07
  • $\begingroup$ @JimB It works for this data but for some other it does not. It shows overflow for some other data. I am not sure how to overcome overflow. I think it overflows because E (or e) gets very big in the guessing. What would be the correct sintaxis to limit E (or e) to be less than something in NonlinearModelFit?. I tried nlm = NonlinearModelFit[data,(1 - Exp[-kref*Exp[(-e/8.314)*((1/360.15) - (1/353.15))]*((t)^n)])*1.2, {{kref, krefguess}, {e, eguess,0<e<1000}}, t] but it did not work $\endgroup$
    – John
    Commented Apr 30, 2020 at 2:08

1 Answer 1

3
$\begingroup$

You can't get there from here. You can estimate k (which equals kref Exp[(-e/8.314) ((1/360.15) - (1/353.15))] but there is an infinite set of kref:e pairs that give you the exact same prediction equation.

Consider the results from

dhnematicmax = 1.2
k = kref Exp[(-e/8.314) ((1/360.15) - (1/353.15))]
nlm = NonlinearModelFit[data, (1 - Exp[-k*((t)^n)])*dhnematicmax, {{kref, 4}, {e, 1}, {n, nguess}}, t]
nlm["BestFitParameters"]
(* {kref -> 5.06019, e -> -39053., n -> 0.893056} *)

That "works" in the sense that values are given for kref and e. However, look at the estimated correlation matrix of the parameter estimators:

nlm["CorrelationMatrix"] // MatrixForm

$$\left( \begin{array}{ccc} 1. & 1. & 0.907781 \\ 1. & 1. & 0.907781 \\ 0.907781 & 0.907781 & 1. \\ \end{array} \right)$$

This says that the first two parameters (kref and e) are perfectly correlated: If you know one value you know the other.

The structure of you model should be what convinces you about the inability to obtain meaningful estimates of kref and e. But look at the mean of the squares of the residuals:

Mean[nlm["FitResiduals"]^2]
(* 0.0143249 *)

Now suppose I arbitrarily declare that kref is not 5.06019 but 10 (twice the initial result) and fit the model with that parameter fixed at my made-up value for kref:

kref = 10;
k = kref Exp[(-e/8.314) ((1/360.15) - (1/353.15))]
nlm = NonlinearModelFit[data, (1 - Exp[-k*((t)^n)])*dhnematicmax, {{e, 1}, {n, nguess}}, t]
nlm["BestFitParameters"]
(* {e -> -141954., n -> 0.893056} *)
Mean[nlm["FitResiduals"]^2]
(* 0.0143249 *)

We see the same exact values for n and the mean of the squared fit residuals but now e is estimated to be a wildly different number.

If we calculate the values for k from each model we see the same resulting value:

kref Exp[(-e/8.314) ((1/360.15) - (1/353.15))] /. kref -> 5.060185197547436` /. e -> -39052.97750976022`
(* 3.90743 *)

kref Exp[(-e/8.314) ((1/360.15) - (1/353.15))] /. kref -> 10 /. e -> -141953.5476546686`
(* 3.90743 *)
$\endgroup$
1
  • $\begingroup$ This is a great answer @JimB thank you !!! $\endgroup$
    – John
    Commented Apr 30, 2020 at 3:04

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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