[R] want to make a plot similar to ecdf
jim holtman
jholtman at gmail.com
Wed Dec 19 14:11:09 CET 2007
This should give you what you want:
x <- scan(textConnection("0.00000000 2.39722222 4.35000000
-4.19722222 0.63611111
1.08055556 5.90555556 -1.87222222 2.13333333 -1.18055556
3.61666667 0.87777778 8.33888889 3.84166667 1.11111111
-3.76111111 -11.67777778 -2.03055556 6.94444444 -11.76666667
4.81111111 -7.25833333 1.42222222 5.37222222 4.68055556
0.69166667 -5.36944444 5.35555556 4.26944444 6.14722222
0.42500000 2.90555556 11.74166667 5.99444444 3.60555556
-2.18333333 2.07777778 -9.79722222 7.26111111 4.50277778
0.84722222 0.42222222 1.01388889 -0.04722222 5.03611111
0.26666667 0.10555556 1.01666667 5.65833333 4.11111111
0.23055556 8.53611111 4.42222222 4.93055556 13.41111111
0.00000000 0.00000000 13.37500000 1.52500000 6.35833333"), what=0)
x <- sort(x)
plot(x, cumsum(rep(1, length(x))), type='s')
On Dec 19, 2007 7:26 AM, gallon li <gallon.li at gmail.com> wrote:
> I have a sample of observations:
>
> > yy
> [1] 0.00000000 2.39722222 4.35000000 -4.19722222 0.63611111
> [6] 1.08055556 5.90555556 -1.87222222 2.13333333 -1.18055556
> [11] 3.61666667 0.87777778 8.33888889 3.84166667 1.11111111
> [16] -3.76111111 -11.67777778 -2.03055556 6.94444444 -11.76666667
> [21] 4.81111111 -7.25833333 1.42222222 5.37222222 4.68055556
> [26] 0.69166667 -5.36944444 5.35555556 4.26944444 6.14722222
> [31] 0.42500000 2.90555556 11.74166667 5.99444444 3.60555556
> [36] -2.18333333 2.07777778 -9.79722222 7.26111111 4.50277778
> [41] 0.84722222 0.42222222 1.01388889 -0.04722222 5.03611111
> [46] 0.26666667 0.10555556 1.01666667 5.65833333 4.11111111
> [51] 0.23055556 8.53611111 4.42222222 4.93055556 13.41111111
> [56] 0.00000000 0.00000000 13.37500000 1.52500000 6.35833333
>
> I want to make an empirical distribution plot. But, I wish that the y-axis
> is the count instead of probability.
>
> plot(ecdf(yy))
>
> can only give the cumulative distribution on the y-axix.
>
> [[alternative HTML version deleted]]
>
> ______________________________________________
> 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.
>
--
Jim Holtman
Cincinnati, OH
+1 513 646 9390
What is the problem you are trying to solve?
More information about the R-help
mailing list