Fitting data to line with a specific slope
- To: mathgroup at smc.vnet.net
- Subject: [mg30618] Fitting data to line with a specific slope
- From: "Catherine Neish" <cdneish at interchange.ubc.ca>
- Date: Fri, 31 Aug 2001 04:09:43 -0400 (EDT)
- Sender: owner-wri-mathgroup at wolfram.com
Hi there.
I am attempting to fit my data to a line of the form
y = -3.2 x + intercept,
but I cannot figure out how to do this with Mathematica.
The function "Fit" takes only basis functions, so I cannot specify that I
would like the slope to be -3.2. I also tried "NonlinearFit," but the
following code
NonlinearFit[data, intercept - 3.2 x, x, intercept]
yielded the following error message:
Tranpose::nmtx : The first two levels of the one-dimensional list {} cannot
be transposed
Tranpose::nmtx : The first two levels of the one-dimensional list {-3.2}
cannot be transposed
NonlinearFit::lnnosvd : NonlinearFit was unable to obtain the singular value
decomposition for the design matrix of the linear model.
NonlinearFit::fitfail : The fitting algorithm failed.
It is possible that my data does not fit a line with slope -3.2 very well.
Could this be the source of the errors?
Any advice regarding these problems would be greatly appreciated.
Sincerely,
Catherine Neish