Re: Non-linear Rgression
- To: mathgroup at smc.vnet.net
- Subject: [mg71637] Re: Non-linear Rgression
- From: Bill Rowe <readnewsciv at sbcglobal.net>
- Date: Sat, 25 Nov 2006 05:37:18 -0500 (EST)
On 11/24/06 at 1:17 AM, amin67r at gmail.com (aminr) wrote: >Hello, I'm a physics student.I have done an experiment .I want to >use Mathematica , I found a problem in using it : >for example I have data ={ {0,0},{1,2},{3,6}} and I want to fit >them for a equation such as " y=Log[Cosh[a*x]] " so I want the value >of parametre"a" and also its error(i.e. a=0.045+- 0.05 then error >is 0.05 ) >and also the regression (i.e. R=0.995 ) >please ,please , tell me how I can do it ? If only the best fit parameters are needed, then the built in function FindFit does what you need. For example; In[19]:= data={{0,0},{1,2},{3,6}}; In[20]:= FindFit[data,Log[Cosh[a x]],{a},x] Out[20]= {a -> 2.2753570110148678} To easily get confidence intervals etc, the best choice would be to use the non-linear regression package that is part of the standard add ons. That is: In[21]:= <<Statistics` In[22]:= NonlinearRegress[data, Log[Cosh[a*x]], x, {a}, RegressionReport -> {BestFitParameters, ParameterCITable, AsymptoticCorrelationMatrix}] Out[22]= {BestFitParameters -> {a -> 2.2753570110148678}, ParameterCITable -> TableForm[ {{"", "Estimate", "Asymptotic SE", "CI"}, {a, 2.2753570110148678, 0.09599842662397484, {1.8623091186495693, 2.6884049033801674}}}, TableDepth -> 2, TableHeadings -> {{a}, {"Estimate", "Asymptotic SE", "CI"}}], AsymptoticCorrelationMatrix -> MatrixForm[{{1.}}]} Note a variety of fit statistics are available when using NonlinearRegress. See the documentation for details. -- To reply via email subtract one hundred and four