2 (1 & lsfit) \"1 t

applies 1 u\ on each row.  So it's applying u to
0 7;7 8

not  0 7;5 3  which would produce the results you expect.

Perhaps you want

u"1 |: t

& then put the output into the desired shape.

Henry Rich

Bill Harris wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
> 
> I'm using J a lot more these days and very happy.  Yet today I came up
> with a problem that's bugging me.
> 
>    load jpath '~addons/stats/base/multivariate.ijs'
>    t=: 2 8 $ ? 16 # 10
>    t
> 0 7 8 9 2 2 5 5
> 5 3 8 0 0 5 9 6
>    _2 <\"1 t
> ┌───┬───┬───┬───┐
> │0 7│8 9│2 2│5 5│
> ├───┼───┼───┼───┤
> │5 3│8 0│0 5│9 6│
> └───┴───┴───┴───┘
>    2 <\"1 t
> ┌───┬───┬───┬───┬───┬───┬───┐
> │0 7│7 8│8 9│9 2│2 2│2 5│5 5│
> ├───┼───┼───┼───┼───┼───┼───┤
> │5 3│3 8│8 0│0 0│0 5│5 9│9 6│
> └───┴───┴───┴───┴───┴───┴───┘
>    1 lsfit 0 7,: 5 3
> 5 _0.285714
>    (1 & lsfit) 0 7,: 5 3
> 5 _0.285714
>    1 lsfit t
> 4.56643 _0.013986
> 
> So far, so good.  
> 
> What I want to do is to see how the fit has changed over time (I'm
> actually fitting to a second-order polynomial, but this is easier to
> demonstrate).  
> 
> I think I'd like to use prefix to apply lsfit to successive parts of the
> right argument.
> 
> Yet
> 
>    2 (1 & lsfit) \"1 t
>        7 1.28 1.24615 0.243902 1.2       3  1.15385
> 0.692308  3.2       0        0   5 2.07692 0.731707
> 
> and the first pair output doesn't match up with 5 _0.285714 above.  I
> figure I'm missing something with regard to rank, but neither thinking
> nor trying has turned up anything good so far.
> 
> What am I missing?  Any thoughts on the process, too?
> 
> Thanks,
> 
> Bill
> - -- 
> Bill Harris                      http://facilitatedsystems.com/weblog/
> Facilitated Systems                              Everett, WA 98208 USA
> http://facilitatedsystems.com/                  phone: +1 425 337-5541
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v1.4.9 (GNU/Linux)
> 
> iEYEARECAAYFAkmskakACgkQ3J3HaQTDvd8Y/wCfeRx2ykAg+9EoV9MNYFJgEC2+
> V5kAn11/0l1PqKl0zREdGxt5jPgg015F
> =/Pew
> -----END PGP SIGNATURE-----
> ----------------------------------------------------------------------
> For information about J forums see http://www.jsoftware.com/forums.htm
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to