Re: Fit data
- To: mathgroup at smc.vnet.net
- Subject: [mg124710] Re: Fit data
- From: Darren Glosemeyer <darreng at wolfram.com>
- Date: Wed, 1 Feb 2012 03:52:55 -0500 (EST)
- Delivered-to: l-mathgroup@mail-archive0.wolfram.com
- References: <201201301009.FAA17575@smc.vnet.net>
On 1/30/2012 4:09 AM, Miguel Camino wrote: > Hi, I'm new in this forum and with Mathematica..I've got 2 questions;Is too much? > 1. I've to regress some data with a formula that I've implemented.This is an Example of my data and this is my formula:sigma=a*pc^(0.618)*tc*(1+omega)^c*(1-tr)^dtr, omega, tc, pc sigma0.703784817, 0.310237474, 361.0989249, 34.97280104, 12.410.710106871, 0.310283818, 361.1126025, 34.94104003, 12.140.715649046, 0.310330225, 361.1262985, 34.90923611, 11.770.720912444, 0.310376694, 361.1400131, 34.87738919, 11.520.726476477, 0.31043254, 361.1564951, 34.83911601, 11.30.731293672, 0.310479148, 361.1702505, 34.80717419, 11I used this formulafit = NonlinearModelFit[data, a*pc^(0.618)*tc^b*(1 + omega)^c*(1 - Tr)^d, {a, b, c, d}, {Tr, omega, tc, pc}]and I try to calculate best {a,b,c,d}. > 2. I don't know if 0.618 is the best value. Is thes a way to find the best number that Fit my data?Thanks and sorry for two questions!M. > > For question 1, your data will need to be a numeric matrix with 5 columns. The first 4 columns will be the values of tr, omega, tc, and pc, and the last will be the sigma values. Note that Tr is a built-in Mathematica function, so I would recommend using tr or something else that doesn't start with a capital letter. You may also need to give starting values for the parameters a, b, c, and d to get a good fit; this is just the nature of nonlinear optimization. For question2, you could replace 0.618 in the formula by some symbol (say p) and add that symbol to the list of parameters to estimate. If .618 seems like a reasonable value for your data, you could use that as a starting value for p. Darren Glosemeyer Wolfram Research