1/5 Estimating the error per point fi 1 f xi m f ' xi fi f xi i fi 1 f xi p f ' xi 2m f '' xi i 1 2 (1) 2 p f '' xi i 1 2 Use the equation for fi to eliminate f(xi) from the other two 2m fi 1 fi m f ' xi f '' xi i 1 i 2 (2) 2p fi 1 fi p f ' xi f '' xi i 1 i 2 Multiply the top equation by p and the bottom by m and add the two equations m 2p p m2 m fi 1 fi p fi 1 fi f '' xi m i 1 i p i 1 i (3) 2 Assume that 2 f '' xi so that this term can be dropped. So that m fi 1 f i p fi 1 fi m i 1 i p i 1 i Square equation (4) (4) m fi 1 f i p fi 1 fi m2 i21 2 i 1 i i2 2 m p i 1 i 1 i i 1 i 1 i2 2 2p i21 2 i 1 i i2 (5) Finally make a conceptual ensemble average over all possible values of and note that the cross terms are plus and minus averaging to zero while the squared terms are only + so that 2 2 (6) mi fi 1 fi pi fi 1 fi mi i21 i2 2mi pi i2 2p i21 i2 Details on simulating errors are in SimErr.doc A few details about this as an expectation value are in Expectation values.doc Once this file has been constructed, this is just another curve fit problem. The normal input of xi,fi,I fi,i2,3i2 On the first pass the error term is R,0,0,0. On the second pass it is given by the fit. The poly is of order 3. Minimization Assume that i2 a b fi cfi 2 (7) The constants a, b and c can be determined by minimizing 2/5 f f f f 2 pi i 1 i i mi i 1 2 2a b f f c f 2 f 2 N 1 i 1 i i 1 i mi 2 a, b, c 2 i 2 2 a b f cf mi pi i i 2p 2a b fi 1 fi c fi 21 fi 2 2 (8) With respect to a, b, and c Sort out the a, b, and c dependences f f f f 2 a 2 2 2 pi i 1 i mi pi mi pi i mi i 1 N 1 2 2 2 2 2 a, b, c b fi 1 mi fi mi 2 mi pi pi fi 1 pi i 2 2 2 c fi 21 mi fi 2 mi 2 mi pi 2pi fi 21 2pi Define Fdi mi fi 1 f i pi fi 1 fi 2 ACi 2 mi pi mi 2pi 2 (10) (11) BCi fi 1 2mi fi 2mi 2 mi pi 2pi fi 1 2pi (12) 2 2 CCi fi 21 mi fi 2 mi mi pi 2pi fi 21 2pi (13) So that N 1 2 2 a, b, c FC 2i aACi bBCi cCCi (14) i 2 The partials with respect to a, b, and c are 2 a, b, c N 1 Fdi aACi bBCi cCCi ACi a i 2 2 a, b, c b N 1 Fdi aACi bBCi cCCi BCi i 2 2 a, b, c c N 1 Fdi aACi bBCi cCCi CCi i 2 Then define N 1 FdA Fdi ACi i2 N 1 FdB Fdi BCi i 2 N 1 FdC Fdi CCi i 2 And also define (16) (15) 2 (9) 3/5 N 1 AAS ACi ACi i 2 N 1 ABS ACi BCi i 2 N 1 ACS ACi CCi i 2 N 1 BAS BCi ACi ABS i2 N 1 BBS BCi BCi i2 N 1 BCS BCi CCi i 2 N 1 CAS CCi ACi ACS i2 N 1 CBS CCi BCi BCS i2 N 1 CCS CCi CCi (17) i 2 So that setting the derivatives in (15) to zero the equations for a, b and c become FdA a AAS b ABS c ACS FdB a ABS b BBS c BCS FdC a ACS b BCS c CCS (18) The code sminv from CHOLESKY.doc htm – or in nlfit\formp\robmin.for could be used to solve (18), but it is also easily to manually do the eliminations. First note that since f’s are traditionally between 0 and 100, the last terms dominate and can easily be rmoved first. Thus begin by using the first line to eliminate c. BCS BCS BCS a ABS AAS b BBS ABS ACS ACS ACS CCS CCS CCS FdC FdA a ACS AAS b BCS ABS ACS ACS ACS FdB FdA Define BCS ACS CCS FdChat FdC FdA ACS And FdBhat FdB FdA (20) (19) 4/5 BCS ACS CCS ACShat ACS AAS ACS And BCS BBShat BBS ABS ACS CCS BCShat BCS ABS ACS So that (19) becomes ABShat ABS AAS (21) (22) FdBhat a ABShat b BBShat FdChat a ACShat b BCShat Now eliminate b FdBhat a ABShat b BBShat BCShat FdChat FdBhat BBShat a BCShat ACShat ABShat BBShat (23) Then FdChat a ACShat BCShat FdC a ACS b BCS c CCS b (24) (25) And a test equation 0 FdA a AAS b ABS c ACS (26) Simplification The constant term only Note that if only a is used to minimize 2 (9), that the solution is a=FdA/AAS Linear only If there is no c, the equations for minimizing 2 (18) become FdA a AAS b ABS (27) FdB a ABS b BBS FdB FdA BBS / ABS a ABS AAS BBS / ABS FdB FdA BBS / ABS (29) a ABS AAS BBS / ABS FdB a ABS (30) b BBS (28) 5/5 B only If there is only b - Poisson statistics err = (bfi) - , the equations for minimizing (9) become 2 FdB b BBS b FdB / BBS c only If there is only c - err = fi c ) - , the equations for minimizing 2 (9) become FdC c CCS c FdC / CCS