MathGroup Archive 2006

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

Search the Archive

Weights option to Regress command not behaving as expected

  • To: mathgroup at
  • Subject: [mg70804] Weights option to Regress command not behaving as expected
  • From: Stern <nycstern at>
  • Date: Sat, 28 Oct 2006 05:21:42 -0400 (EDT)
  • References: <>

I am looking to run regressions to fit a curve to a time series, and I
want older data to weigh less in the fitting than newer data does.
However, I can't seem to make this work as expected.

For the sake of example, imagine 100 periods with a binary time series
-- it's 0 until time 50, then 1 until time 100.

binaryjumpdata =

 simplefit =

Out = -0.257576+0.0150015 x

Fine. Now, compare the following two weighting functions:

forwardweights = Table[1/n, {n, 1, 100}]);

backweights = Table[1/(100-n+1), {n, 1, 100}]);

forwardweights drops from 1 to .01, while backweights runs the other
way, from .01 to 1. Applying these two weighting lists to the
binaryjumpdata curve and running the Regress function *should* produce
different best fit line. Forwardweights should produce a lower line,
and backweights should produce a higher one. However,

weightedfit =


reverseweightedfit =

The answer is different from that of the unweighted series, as
expected, but both the forward and reverse application of the weights
produce the exact same output -- -0.0941409+0.0117652  x

Clearly, the Weights command is not doing what I expect. What am I missing?

Thanks in advance for any help.

Michael Stern

  • Prev by Date: Re: DownValues and Cases
  • Next by Date: Re: Bug in RowReduce of a matrix with symbolic entries
  • Previous by thread: Re: DisplayTogether & PlotLegend incompatibility
  • Next by thread: "unload" a package