Package descriptive, working with frequency lists



El 11/12/12 11:36, Andreas Goebel escribi?:
> Hi,
Hallo, Andreas
>
> Size 178 179 180 181 182
> count 2 4 5 5 3

In situations like this, when I want a sample with certain properties 
for pedagogical reasons, I prefer to simulate the records with function 
'random_general_finite_discrete' from package 'distrib'. Following your 
example above,


load (distrib)$
m: 177 + random_general_finite_discrete([2, 4, 5, 5, 3], 500)$
write_data( transpose(matrix(m)), "data" ) $


This simulates 500 observations of 1 thru 5, with probabilities 
proportional to 2, 4, 5, 5, and 3, respectively. Then I add 177 to each 
outcome in order to get values from 178 to 182. Then the sample is saved 
in a file, with one observation per row. Students should now read the 
file and make things like calculate the mean, frequencies, or draw a 
barsplot:

k: read_list("data") $
mean(k);
discrete_freq (k);
wxbarsplot(k)$

This way, students mimic what I understand is common practice in 
statistical analysis: record the observations and let the machine make 
the hard work, including counting frequencies.


>
> While the package "descriptive" provides functions for computing mean,
> standard deviation and so on for lists, it does not do so for frequency
> lists. So my students would have to enter the list like this:
> 178 178 179 179 179 179 ....

In case you really need to work with tables of frequencies, function 
'mean' can't handle this situation, unless you, and your students, 
artificially create the sample.

There is a package for R (the best source of inspiration for statistical 
computing) called Hmisc, which contains functions like 'wtd.mean', 
'wtd.var', etc., where wtd stands for weighted.


> So my questions are:
> - does this make sense?
Why not?

> - should there be some checks to avoid errors, for instance if the list
> has the wrong form?
Some checks are always in order.

> - who maintains the descriptive package?
Ich!
>   Whould he / she like to
> implement functions for frequency lists himself, or should I do that and
> submit them (and if so, how?)?
I don't plan to implement them in the near future, but if you want to 
contribute, I'll be glad to help.

--
Mario