Whoa! I take that back (I forgot about a third moment :).
On Sun, Jun 28, 2015 at 2:27 PM, Jose Mario Quintana <
[email protected]> wrote:
> You are right, in the following sense,
>
> ys=. [ * }.@:(% {.)@:(+/)@:(] ^/ i.@:>:@:[)
> update=. ] ,~ -/@:(] * [ {.~ #@:]) % #@:]
>
> simple=. -@:|.@:>@:{:@:p.@:(ys update ^: (#@:[) 1:)f.
>
> mean=. +/ % #
> std =: mean &.: *: @: (- mean)
>
> Y=. 1 2 3 7
>
> (mean ; std) Y
> ┌────┬───────┐
> │3.25│2.27761│
> └────┴───────┘
>
> ( S0=. 3 simple Y )
> 1.6084j0.550768 1.6084j_0.550768 6.53321
> (mean ; std) S0
> ┌────┬───────┐
> │3.25│2.27761│
> └────┴───────┘
>
> However, if complex results are allowed (and I do not see why should not
> be allowed) then the statement: " The vector 'A simplify B' has the same A
> moments as the vector B" does not provide a (full) characterization of the
> result since,
>
> ( S1=. (3&simple + 2*(mean - 3&simple)) Y)
> 4.8916j_0.550768 4.8916j0.550768 _0.0332088
> (mean ; std) S1
> ┌────┬───────┐
> │3.25│2.27761│
> └────┴───────┘
>
> and clearly,
>
> S0 -: S1
> 0
>
> Yet, S0 seems to be a better result compared to S1 in following context:
>
> (mean ; std) *: Y
> ┌─────┬───────┐
> │15.75│19.4084│
> └─────┴───────┘
> (mean ; std) *: S0
> ┌─────┬───────┐
> │15.75│18.9894│
> └─────┴───────┘
> (mean ; std) *: S1
> ┌─────┬───────┐
> │15.75│10.2303│
> └─────┴───────┘
>
> That is, under *: apparently, S0 as opposed to S1, preserves better the
> mean and the std, and under other some other transformations as well, for
> example,
>
> (mean ; std) %: Y
> ┌─────┬────────┐
> │1.698│0.605626│
> └─────┴────────┘
> (mean ; std) %: S0
> ┌───────┬────────┐
> │1.70945│0.572513│
> └───────┴────────┘
> (mean ; std) %: S1
> ┌─────────────────┬──────────────────┐
> │1.47679j0.0607443│1.03934j_0.0863113│
> └─────────────────┴──────────────────┘
>
> (mean ; std) ^ Y
> ┌───────┬───────┐
> │281.707│470.541│
> └───────┴───────┘
> (mean ; std) ^ S0
> ┌───────┬───────┐
> │232.038│322.125│
> └───────┴───────┘
> (mean ; std) ^ S1
> ┌───────┬────────┐
> │75.9723│0j20.618│
> └───────┴────────┘
>
> (mean ; std) ^. Y
> ┌────────┬────────┐
> │0.934417│0.703815│
> └────────┴────────┘
> (mean ; std) ^. S0
> ┌────────┬────────┐
> │0.979417│0.574606│
> └────────┴────────┘
> (mean ; std) ^. S1
> ┌─────────────────┬────────────────┐
> │_0.0724338j1.0472│2.35516j_1.48176│
> └─────────────────┴────────────────┘
>
> Of course, the simplification might not work well when there is some
> variation within the range; but, even then S0 seems to make more sense than
> S1,
>
> (mean ; std) 2 o. Y
> ┌──────────┬────────┐
> │_0.0279837│0.708947│
> └──────────┴────────┘
> (mean ; std) 2 o. S0
> ┌────────┬─────────┐
> │0.294011│0.0673377│
> └────────┴─────────┘
> (mean ; std) 2 o. S1
> ┌────────┬──────────┐
> │0.470473│0j0.276611│
> └────────┴──────────┘
>
> In any case, I find symplify quite interesting but it seems that your
> definition is incomplete. Perhaps, A&simplify should also be required to
> be analytic?
>
>
> On Fri, Jun 26, 2015 at 4:54 AM, 'Bo Jacoby' via Programming <
> [email protected]> wrote:
>
>> datatype 1 2 3 7integer datatype 2 simplify 1 2 3 7floating
>> datatype 3 simplify 1 2 3 7complex (2&simplify=[:2&simplify 3&simplify)
>> 1 2 3 71 1A correct result may be non-real!
>>
>>
>>
>>
>> Den 9:53 fredag den 26. juni 2015 skrev 'Bo Jacoby' via Programming <
>> [email protected]>:
>>
>>
>>
>> Explanation: The vector 'A simplify B' has the same A moments as the
>> vector B.Examples: 1 simplify 0 21 2 simplify 0 20 2 3 simplify 0
>> 2_0.224745 1 2.22474 2 simplify 3 simplify 0 20 2 1 simplify 3 simplify
>> 0 21
>>
>>
>>
>>
>> Den 0:04 fredag den 26. juni 2015 skrev Kip Murray <
>> [email protected]>:
>>
>>
>>
>> 1 X
>>
>> 2 X X
>>
>> 3
>>
>> 4 X
>>
>> 5
>>
>> 6 X
>>
>>
>> 1 X
>>
>> 2
>>
>> 3 X
>>
>> 4
>>
>> 5 X
>>
>> 6
>>
>>
>> 1
>> X
>> 2 X
>>
>> 3
>>
>> 4
>>
>> 5 X
>>
>> 6
>>
>>
>> Above I have attempted three histograms. The first shows the data set 1 2
>> 2 4 6 which has mean 3 and standard deviation 2, median 2 and fourths (not
>> quartiles) 1.5 and 5 . The second histogram shows the mean and the mean
>> plus or minus a standard deviation, and the third histogram shows the
>> median and fourths. (The fourths are respectively the median of the
>> numbers below the median, and the median of the numbers above the median.)
>>
>> --Kip Murray
>>
>>
>> On Thursday, June 25, 2015, Devon McCormick <[email protected]> wrote:
>>
>> > I put together this J based on the "fivenum" routine in R mentioned in
>> the
>> > Wikipedia link:
>> >
>> > fivenum=: 3 : 0
>> > if. 0=#y=. /:~y do. 5#_.
>> > else. n4=. -:<.-:3+#y
>> > d=. <:1,n4,(-:>:#y),(n4-~>:#y),#y
>> > -:(y{~<.d)+y{~>.d
>> > end.
>> > )
>> >
>> > It returns the minimum, the quartile points, and the maximum of a
>> series.
>> > The first branch of the "if" roughly replicates some of the R function's
>> > NA-handling.
>> >
>> > On Thu, Jun 25, 2015 at 10:14 AM, David Lambert <[email protected]
>> > <javascript:;>>
>> > wrote:
>> >
>> > > Is simplify supposed to report the i.x moments of the data? Would be
>> > > useful.
>> > > When I removed the question marks from simplify to make valid j
>> > > 1 simplify DATA NB. does report the mean
>> > > Otherwise I haven't made sense of the results for the verb I created.
>> > >
>> > > datatype N
>> > > integer
>> > >
>> > > 3 simplify N
>> > > _951.236j1533.8 _951.236j_1533.8 2658.39
>> > >
>> > > Date: Thu, 25 Jun 2015 08:39:51 +0000 (UTC)
>> > >> From: "'Bo Jacoby' via Programming"<[email protected]
>> > <javascript:;>>
>> > >> To: Programming Forum<[email protected] <javascript:;>>
>> > >> Subject: [Jprogramming] simplify
>> > >> Message-ID:
>> > >> <
>> [email protected]
>> > <javascript:;>>
>> > >> Content-Type: text/plain; charset=UTF-8
>> > >>
>> > >> NB.?If you have got a bunch of numbers? ? ? ]n=.?20#10035 32 66 37
>> 94 56
>> > >> 44 30 25 70 27 68 49 92 96 79 74 99 72 22NB. and you want to
>> simplify,
>> > then
>> > >> take the mean value
>> > >>
>> > >
>> > > <unreadable cut>
>> > >>
>> > >
>> > > )NB.?If you can simplify the programming, the please let me know.
>> > >> ThanksBo
>> > >>
>> > >
>> > > ----------------------------------------------------------------------
>> > > For information about J forums see
>> http://www.jsoftware.com/forums.htm
>> > >
>> >
>> >
>> >
>> > --
>> > Devon McCormick, CFA
>> > ----------------------------------------------------------------------
>> > For information about J forums see http://www.jsoftware.com/forums.htm
>> >
>>
>>
>> --
>> Sent from Gmail Mobile
>> ----------------------------------------------------------------------
>> For information about J forums see http://www.jsoftware.com/forums.htm
>>
>>
>>
>>
>> ----------------------------------------------------------------------
>> For information about J forums see http://www.jsoftware.com/forums.htm
>>
>>
>>
>> ----------------------------------------------------------------------
>> For information about J forums see http://www.jsoftware.com/forums.htm
>>
>
>
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm