converting a list of value into a list of absolute /relative frequencies

converting a list of value into a list of absolute /relative frequencies

Post by vesd4kz0 » Mon, 01 Dec 2003 18:54:18


Hi,
I have to convert a list of value into a list of absolute /relative frequencies
(I'm not sure if "frenquencies" is the proper transalation of the german word "Hfigkeiten")

The problem seems to be the "Weight" - structure:
"Weight(a..b,k)" is transformed to "a..b" only if k = 1

See what I mean:
-------------------- maple output -----------------------
restart:with(stats):with(transform):with(statplots):with(plots):with(describe):Warning, the
protected name apply has been redefined and unprotected

given data:

data := [176, 172, 180, 176, 174, 180, 176, 170, 172, 174, 172, 180,

182, 170, 177, 166, 167, 174, 181, 181, 165, 169, 170, 179,

173, 172]


classes := [165 .. 166, 166 .. 167, 167 .. 168, 168 .. 169,

169 .. 170, 170 .. 171, 171 .. 172, 172 .. 173, 173 .. 174,

174 .. 175, 175 .. 176, 176 .. 177, 177 .. 178, 178 .. 179,

179 .. 180, 180 .. 181, 181 .. 182, 182 .. 183]


data2 := [Weight(171 .. 172, 0), Weight(172 .. 173, 4), 173 .. 174,

Weight(174 .. 175, 3), Weight(175 .. 176, 0),

Weight(176 .. 177, 3), 177 .. 178, Weight(178 .. 179, 0),

179 .. 180, Weight(180 .. 181, 3), 165 .. 166,

Weight(181 .. 182, 2), 166 .. 167, 182 .. 183, 167 .. 168,

Weight(168 .. 169, 0), 169 .. 170, Weight(170 .. 171, 3)]

absolute frequencies:

H := [[171, 0], [172, 4], [173, 174], [174, 3], [175, 0], [176, 3],

[177, 178], [178, 0], [179, 180], [180, 3], [165, 166],

[181, 2], [166, 167], [182, 183], [167, 168], [168, 0],

[169, 170], [170, 3]]
---------------- end of maple output -------------------------------------------------------

As you can see, the absolute frequency is wrong in the case of "k = 1".

How can I solve that?

Thanks
Robert
 
 
 

converting a list of value into a list of absolute /relative frequencies

Post by Alec Mihai » Tue, 02 Dec 2003 03:51:07


output -------------------------------------------------------

For example, you can do that as follows,


H := [[178, 0], [165, 1], [179, 1], [166, 1], [167, 1], [168, 0],

[180, 3], [169, 1], [181, 2], [170, 3], [182, 1], [171, 0],

[172, 4], [173, 1], [174, 3], [175, 0], [176, 3], [177, 1]]

Alec Mihailovs
http://www.yqcomputer.com/