Mathematica 9 is now available
Services & Resources / Wolfram Forums / MathGroup Archive
-----

MathGroup Archive 2012

[Date Index] [Thread Index] [Author Index]

Search the Archive

LinearModelFit doesn't work with constraints?

  • To: mathgroup at smc.vnet.net
  • Subject: [mg126253] LinearModelFit doesn't work with constraints?
  • From: "Michael B. Heaney" <mheaney at gmail.com>
  • Date: Fri, 27 Apr 2012 06:49:35 -0400 (EDT)
  • Delivered-to: l-mathgroup@mail-archive0.wolfram.com

Why does this fit work with FindFit but not with LinearModelFit? Can it be
fixed to work with LinearModelFit?:

Clear[data]; data = {{115.72406725682761`, -15.570108102859956`}, \
{117.8314200026393`, -15.968691594983845`}, {120.50868883703222`, \
-15.557184099102274`}, {123.16961208975692`, -17.846622221595887`}, \
{125.3164877613608`, -18.43251273767855`}, {128.24732225661378`, \
-16.84848062166309`}, {131.05256326055346`, -17.081766983527483`}, \
{133.7064123558641`, -19.059419077883778`}, {136.18274587879156`, \
-19.208721233907866`}, {139.95296926627307`, -18.628905889943834`}, \
{143.2369087194593`, -18.591163617876923`}, {147.14564801682326`, \
-18.888777713700467`}, {150.85049708613295`, -21.835515088942074`}, \
{153.57145686694008`, -23.25406602083415`}, {156.9233738005359`, \
-22.508610494557008`}, {159.94900229896672`, -22.69235624566059`}, \
{164.25282291760502`, -21.402179278192076`}, {168.2678963595429`, \
-23.077039100878793`}, {172.9451931425859`, -22.880000000000077`}, \
{177.59703028246392`, -23.833509165832456`}, {181.89037272389143`, \
-27.41435932731815`}, {186.93493381792146`, -24.650015260962466`}, \
{193.41672302408762`, -26.41596918746758`}, {196.47059064117093`, \
-30.300000797662353`}, {202.877012880498`, -28.550517035150595`}, \
{207.29663799516817`, -26.260039093487233`}, {213.5919610462257`, \
-28.25441495743196`}, {218.34896467314775`, -32.55484530810561`}, \
{224.4069723198895`, -32.62174158456492`}, {233.64434669525724`, \
-32.080784583708244`}};
ListPlot[data, AxesOrigin -> {0, 0}]
Clear[lmf, a, b, x];
lmf = LinearModelFit[data, {a + b*x, {a < 0, b < 0}}, {a, b}, {x}];
Normal[lmf]




  • Prev by Date: Re: is there internal variable like $0 in perl?
  • Next by Date: Re: Unsatisfactory view of Panel, when transformed to pdf
  • Previous by thread: Re: Integration bug? Integrate[Sin[2 t]^2 Cos[Cos[t - p]], {t, 0, 2 Pi}]
  • Next by thread: Re: LinearModelFit doesn't work with constraints?