# Better output for NonlinearModelFit "ParameterTable"

The Standard table fo parameters of NonlinearModelFit is obtained from

 NonlinearModelFit[{{0, 1}, {1, 2}, {3, 3}}, a + b*x, {a, b}, x]
%["ParameterTable"]]


I woud like to manipulate the numbers in this tabe to my taste.

For some of this I could "ParameterTableEntries", but this gives just the numerical values, not the name of the parameters.

So I would like to know if there is an way to get the fit parameters names in the right order.

My best guess is to manipulate the output of InputForm[%["ParameterTable"]], but I failed so far because of my poor pattern search skills ... any idea?

Thanks, Roberto

• try fit = NonlinearModelFit[{{0, 1}, {1, 2}, {3, 3}}, a + b*x, {a, b}, x]; fit /@ fit["Properties"] any of it of interest to you? Mar 25 '15 at 18:25
• it seems fit["ParameterTableEntries"] is what you want? Mar 25 '15 at 18:30
• no Chris, this is not what I want, as I have pointed out in my original message this function gives only the numerical values, not the names of the paramters, which is what I am ultimately after. Mar 25 '15 at 22:42
• this then: 'fit["ParameterTable"] // First // First // Flatten // Take[#, {1, 6}] &' Mar 25 '15 at 23:20

Assuming you have typed

 fit = NonlinearModelFit[{{0, 1}, {1, 2}, {3, 3}}, a + b*x, {a, b}, x]


you can type

  StringProperties[NonlinearModelFit]


then you can type

StringProperties[NonlinearModelFit, All]


and get

You will easily see that what you want is

  fit["ParameterTableEntries"]


( 1.14286 0.225877 5.05964 0.124222 0.642857 0.123718 5.19615 0.121038 )

## Update

If you want the headers this ought to do it

 fit["ParameterTable"] // First // First // Flatten //
Take[#, {1, 6}] &

• Great way to get the information on the parameters, but I am not after the table entries, I am after the table headings, i.e. the names of the fit parameters. I think there is no way to miss that "parameters names" is what I am after, so I have to down-vote this answer. Sorry. Mar 25 '15 at 22:44
• Dear Chris, Thanks for this attempt. Your {1,6} seems to be specific to a case you were trying, as it does not work on the example I posted. I think is more general to do Drop[(%["ParameterTable"] // First // First)[[All, 1]], 1] which returns the whole column of parameters. Mar 26 '15 at 8:44
• @RobertoFranceschini well you can now answer your own question. Mar 26 '15 at 9:15
data = Table[{x, Exp[.2 + .3 x + .1 Sin[x] + RandomReal[{-.2, .2}]]},
{x, RandomReal[5, 100]}];
nlm = NonlinearModelFit[data, Exp[a + b Sin[x] + c Cos[x]], {a, b, c}, x];
pt = nlm["ParameterTable"];


You can also use Part as follows to access the row labels, column labels and the content of pt:

rowlabels = Sequence[1, 1, 2 ;;, 1];
collabels = Sequence[1, 1, 1, 2 ;;];
content = Sequence[1, 1, 2 ;;, 2 ;;];

pt[[rowlabels]]
(* {a, b, c} *)

pt[[collabels]]
(* {"Estimate", "Standard Error", "t-Statistic", "P-Value"} *)

pt[[content]]
(* {{1.00159, 0.0252967, 39.5938, 1.10726*10^-61},
{-0.375734, 0.0304626, -12.3343, 1.3907*10^-21},
{-0.157534, 0.0357183, -4.41046, 0.0000267067}} *)

pt[[content]] == nlm["ParameterTableEntries"]
(* True *)

Row[Labeled[#, #2, Top] & @@@ {{pt,"ParameterTable\n"},
{MapAt[Style[2 #, Red, 20] &, pt, {{1, 1, 2, 4}}],
"ParameterTable\nwith part {1,1,2,4} modified"}}, Spacer[10]]


Drop[(%["ParameterTable"] // First // First)[[All, 1]], 1]