File: Ecdf.r

package info (click to toggle)
hmisc 5.2-5-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 4,044 kB
  • sloc: asm: 28,907; f90: 590; ansic: 415; xml: 160; fortran: 75; makefile: 2
file content (20 lines) | stat: -rw-r--r-- 651 bytes parent folder | download | duplicates (6)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
## From Bayazid Sarkar <sarkarbayazid@gmail.com>
require(Hmisc)
set.seed(1)
x <- exp(rnorm(100))
w <- sample(1:5, 100, TRUE)
g <- sample(c('a','b','c'), 100, TRUE)

Ecdf(log(x), weights=w, lty=1:3, col=1:3, group=g, label.curves=list(keys=1:3),
     subtitles=FALSE)

Ecdf(x, weights=w, lty=1:3, col=1:3, group=g, label.curves=list(keys=1:3),
     subtitles=FALSE, log='x')

## From Piotr Balwierz
reds <- rnorm(n=100, mean=5, sd=1)
blues <- rnorm(n=100, mean=0, sd=1)
g <- c(rep("red", length(reds)),
       rep("blue", length(blues)))
Ecdf(x=c(reds, blues), group=g, col=c("red", "blue"))
Ecdf(c(reds, blues), group=factor(g), col=c('blue', 'red'))