up to cum rel freq graph

This commit is contained in:
Dan Buch 2011-07-12 22:04:59 -04:00
parent 3477ee16ef
commit 121ed7f478
2 changed files with 48 additions and 0 deletions

Binary file not shown.

View File

@ -234,3 +234,51 @@ lines(breaks, cumfreq0)
plot(breaks, cumfreq0, main="Old Faithful Intervals", xlab="Interval minutes", ylab="Cumulative Intervals") plot(breaks, cumfreq0, main="Old Faithful Intervals", xlab="Interval minutes", ylab="Cumulative Intervals")
lines(breaks, cumfreq0) lines(breaks, cumfreq0)
q() q()
duration = faithful$eruptions
breaks = seq(1.5, 5.5, by=0.5)
duration.cut = cut(duration, breaks, right=FALSE)
duration.freq = table(duration.cut)
duration.cumfreq = cumsum(duration.freq)
duration.cumrelfreq = duration.cumfreq / nrow(faithful)
duration.cumrelfreq
old = options(digits=2)
duration.cumrelfreq
options(old)
duration.cumrelfreq
cbind(duration.cumfreq, duration.cumrelfreq)
interval = faithful$waiting
min(interval)
max(interval)
ceiling(max(interval))
help(ceiling)
interval * 0.10
max(interval) * 0.1)
ceiling(max(interval) * 0.1)
interval_breaks = seq(floor(min(interval) * 0.1) * 10.0, ceiling(max(interval) * 0.1) * 10.0, right=FALSE)
interval_breaks
interval_breaks = seq(floor(min(interval) * 0.1) * 10.0, ceiling(max(interval) * 0.1) * 10.0, by=nrow(interval) / 10.0, right=FALSE)
interval_breaks = seq(floor(min(interval) * 0.1) * 10.0, ceiling(max(interval) * 0.1) * 10.0, by=(nrow(faithful) / 10.0), right=FALSE)
interval_breaks
interval_breaks = seq(floor(min(interval) * 0.1) * 10.0, ceiling(max(interval) * 0.1) * 10.0, by=(nrow(faithful) / 5.0), right=FALSE)
interval_breaks
interval_breaks = seq(floor(min(interval) * 0.1) * 10.0, ceiling(max(interval) * 0.1) * 10.0, by=(nrow(faithful) / 20.0), right=FALSE)
interval_breaks
interval_breaks = seq(floor(min(interval) * 0.1) * 10.0, ceiling(max(interval) * 0.1) * 10.0, by=(nrow(faithful) / 30.0), right=FALSE)
interval_breaks
interval_breaks = seq(floor(min(interval) * 0.1) * 10.0, ceiling(max(interval) * 0.1) * 10.0, by=5.0 right=FALSE)
interval_breaks = seq(floor(min(interval) * 0.1) * 10.0, ceiling(max(interval) * 0.1) * 10.0, by=5.0, right=FALSE)
interval_breaks
length(interval_breaks)
type(interval_breaks)
typeof(interval_breaks)
interval
interval.freq
interval.cut = cut(interval, interval_breaks, right=FALSE)
interval.cut
interval.freq = table(interval.cut)
interval.cumfreq = cumsum(interval.freq)
interval.cumfreq
interval.cumrelfreq = interval.cumfreq / nrow(faithful)
interval.cumrelfreq
cbind(interval.cumfreq, interval.cumrelfreq)
q()