Hi Jose.
No sir! I have not considered that generalization of the verb 'simplify'. I
will look into it.
(I must remember to use double enter in order that the mail program does not
mess up my mail.)
(k simplify n) has the same k moments as vector n.
Examples of simplify:
simplify
4 : 0
y=.x*}.(%{.)+/y^/i.>:x
x=.1
for.y do.x=.((-/x*(#x){.y)%#x),x end.
-|.>{:p.x
)
]n=.?8#0 NB. test data
0.17212 0.51129 0.190085 0.752359 0.223673 0.177596 0.730671 0.766152
1 simplify n NB. mean value
0.440493
2 simplify n NB. mean plusminus std.dev.
0.179873 0.701114
3 simplify n
0.138829 0.407932 0.774719
(3 & simplify &. (10&+)) n NB. adding a constant
0.138829 0.407932 0.774719
(3 & simplify &. (10&*)) n NB. multiply by constant
0.138829 0.407932 0.774719
2 simplify 3 simplify n NB. further simplifying
0.179873 0.701114
1 simplify 2 simplify n NB. further simplifying
0.440493
Thanks! Bo.
Den 21:16 søndag den 17. juli 2016 skrev Jose Mario Quintana
<[email protected]>:
Hi Bo,
The particular monadic case 2&simplify, as I understand it, produces a
vector (of size two) which has the same two moments as the original vector
(e.g., if the argument Y is a vector of univariate observations, for
instance the heights of a group of N people then the product of
2&simplify Y would be a vector Z of two "heights" which would have the
same mean and variance as Y ).
Now, assume one also has the weights of the same group of people and the
bivariate observations Y contains now their heights and weights collected
as a matrix with N rows and two columns (height and weight). The problem
is: find another matrix Z of "heights and weights" with a minimum number
M of rows (M <: N) such that the (1x2) mean vector and the (2x2)
variance-covariance matrix of Z are the same as the mean and
variance-covariance matrix of Y . More generally, what would be the
corresponding Z for multivariate observations? (I guess the number of rows
M , apart from rounding, should depend linearly on the number of columns
of the multivariate observations.)
I was just wondering if you had consider that kind of problems.
On Fri, Jun 26, 2015 at 3:50 AM, 'Bo Jacoby' via Programming <
[email protected]> wrote:
> 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