[R] feed cut() output into goodness-of-fit tests
Ista Zahn
izahn at psych.rochester.edu
Fri Oct 15 22:14:27 CEST 2010
On Fri, Oct 15, 2010 at 10:22 AM, Andrei Zorine <zoav1602 at gmail.com> wrote:
> Hello,
> My question is assuming I have cut()'ed my sample and look at the
> table() of it, how can I compute probabilities for the bins?
I actually don't know what you mean by this (my own ignorance probably).
Do I have
> to parse table's names() to fetch bin endpoints
For equal-width bins you can use
seq(min(x), max(x), by = (max(x) - min(x))/10)
HTH,
Ista
to pass them to
> p[distr-name] functions? i really don't want to input arguments to PDF
> functions by hand (nor copy-and-paste way).
>
>> x.fr <- table(cut(x,10))
>> x.fr
>
> (0.0617,0.549] (0.549,1.04] (1.04,1.52] (1.52,2.01] (2.01,2.5]
> 16 28 26 18 6
> (2.5,2.99] (2.99,3.48] (3.48,3.96] (3.96,4.45] (4.45,4.94]
> 3 2 0 0 1
>
>> names(x.fr)
> [1] "(0.0617,0.549]" "(0.549,1.04]" "(1.04,1.52]" "(1.52,2.01]"
> [5] "(2.01,2.5]" "(2.5,2.99]" "(2.99,3.48]" "(3.48,3.96]"
> [9] "(3.96,4.45]" "(4.45,4.94]"
>
>
> --
>
> Andrei Zorine
>
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>
--
Ista Zahn
Graduate student
University of Rochester
Department of Clinical and Social Psychology
http://yourpsyche.org
More information about the R-help
mailing list