Question:
I have some data, with a y=Ae^(-kt) model applied (It's a radioactive decay), thanks to answers on another question, the model is applied and returns the relevant numbers, but I need the value for the Chi^2 as a quantification for goodness of fit. Can anyone help me with how to about this? I've used PearsonChiSquaredFit in the example below.
Minimalised Example:
dataHist5 = {{Around[16.5, 1.5], Around[77.8, 8.8]}, {Around[34.5, 1.5], Around[60.5, 8.0]}, {Around[52.5, 1.5], Around[63.8, 8.0]}, {Around[106.5, 1.5], Around[42.4, 6.5]}, {Around[124.5, 1.5], Around[41.7, 6.5]}, {Around[142.5, 1.5], Around[14.6, 3.8]}, {Around[160.5, 1.5], Around[33.9, 5.8]}, {Around[178.5, 1.5], Around[29.4, 5.4]}}} data = Transpose[{dataHist5[[All, 1, 1]], dataHist5[[All, 2, 1]]}]; ListLogPlot[data] logData = data; logData[[All, 2]] = Log[data[[All, 2]]]/data[[All, 1]]; nlm = NonlinearModelFit[logData, loga/t - k, {loga, k}, t]; nlm["BestFitParameters"] Show[ListPlot[data], Plot[Exp[t nlm[t]], {t, 1, 700}]] ListPlot[Transpose[{logData[[All, 1]], nlm["FitResiduals"]}], PlotRange -> All] logData = data; logData[[All, 2]] = Log[data[[All, 2]]]/data[[All, 1]]; nlm = NonlinearModelFit[logData, loga/t - Log[2]/halfLife, {loga, halfLife}, t]; nlm["ParameterTable"] PearsonChiSquareTest[logData, nlm] This returns:
PearsonChiSquareTest::rctnlndst: The argument FittedModel[-0.00676871+4.44614/t] at position 2 should be a valid distribution or a rectangular array of real numbers with length greater than the dimension of the array. The dimensionality of the arguments at positions 1 and 2 must match. {{16.5, 0.263887}, {34.5, 0.118917}, {52.5, 0.0791572}, {106.5, 0.0351845}, {124.5, 0.0299639}, {142.5, 0.0188142}, {160.5, 0.0219527}, {178.5, 0.0189411}, {196.5, 0.0178705}, {214.5, 0.0159942}, {232.5, 0.0147837}, {250.5, 0.0122477}, {268.5, 0.00543246}, {286.5, 0.00647923}, {322.5, 0.00624776}, {340.5, 0.00441726}, {358.5, 0.00668869}, {376.5, 0.00700945}, {394.5, 0.00668963}, {466.5, -0.00109502}, {484.5, 0.00162736}, {520.5, 0.00430492}, {538.5, 0.00262022}, {646.5, 0.00121958}, {682.5, -0.000748462}}, \!\(\* TagBox[ RowBox[{"FittedModel", "[", TagBox[ PanelBox[ TagBox[ RowBox[{ RowBox[{"-", "0.00676871191449669`"}], "+", FractionBox["4.4461438703116665`", "t"]}], Short[#, 2]& ], FrameMargins->5], Editable -> False], "]"}], InterpretTemplate[ FittedModel[{ "Nonlinear", {$CellContext`loga -> 4.4461438703116665`, \ $CellContext`halfLife -> 102.40459179174366`}, ... Exponential Decay Graph of the expanded data set: 
EDIT - R^2: I managed to find this for finding R^2. Ideally I would like to be able to return something like this for Chi^2
Grid[Transpose[{#, nlm[#]} &[{"AdjustedRSquared", "AIC", "BIC", "RSquared"}]], Alignment -> Left] For me this returns: R^2 = 0.998555 Though that does look a bit high for the fit above.
EDIT - Real Data: Posting real data as requested:
dataHist5 = {{Around[16.5, 1.5], Around[77.8, 8.8]}, {Around[34.5, 1.5], Around[60.5, 8.0]}, {Around[52.5, 1.5], Around[63.8, 8.0]}, {Around[106.5, 1.5], Around[42.4, 6.5]}, {Around[124.5, 1.5], Around[41.7, 6.5]}, {Around[142.5, 1.5], Around[14.6, 3.8]}, {Around[160.5, 1.5], Around[33.9, 5.8]}, {Around[178.5, 1.5], Around[29.4, 5.4]}, {Around[196.5, 1.5], Around[33.5, 5.8]}, {Around[214.5, 1.5], Around[30.9, 5.6]}, {Around[232.5, 1.5], Around[31.1, 5.8]}, {Around[250.5, 1.5], Around[21.5, 4.6]}, {Around[268.5, 1.5], Around[4.3, 2.1]}, {Around[286.5, 1.5], Around[6.4, 2.5]}, {Around[322.5, 1.5], Around[7.5, 2.7]}, {Around[340.5, 1.5], Around[4.5, 2.1]}, {Around[358.5, 1.5], Around[11., 3.3]}, {Around[376.5, 1.5], Around[14.0, 3.7]}, {Around[394.5, 1.5], Around[14.0, 3.7]}, {Around[466.5, 1.5], Around[0.6, 0.7]}, {Around[502.5, 1.5], Around[2.2, 1.5]}, {Around[520.5, 1.5], Around[9.4, 3.1]}, {Around[538.5, 1.5], Around[4.1, 2.0]}, {Around[646.5, 1.5], Around[2.2, 1.5]}, {Around[682.5, 1.5], Around[0.6, 0.7]}} EDIT - Recreating Answer
Show[ListPlot[dataHist5], Plot[fit[x], {x, 0, 800}, PlotRange -> All]] fit["ANOVATableSumsOfSquares"][[2]] (*chi^2*) fit["ANOVATableMeanSquares"][[2]] (*chi^2/dof*) uncertainties = dataHist5[[All, 2, 2]]; fit = NonlinearModelFit[rawDataHist5, A*Exp[-k*t], {A, k}, t, Weights -> 1/uncertainties^2]; Produces: Chi^2 = 90.68, Chi^2/DOF = 3.94. Which slightly differs from the quoted results of 90.75, 3.95 respectively. I'm not too sure why. The data isn't great so 3.95 seems like a realistic figure.

GeneralizedLinearModelFit. As a statistician when I want to do brain surgery, I consult a brain surgeon. Just a suggestion. $\endgroup$