Solution

> p <- (f <- table(t))/sum(f)
> p
t
         A          B          D          F         GB          I        SLO 
0.07142857 0.14285714 0.14285714 0.35714286 0.07142857 0.14285714 0.07142857 
> sum(p)
[1] 1
> F <- cumsum(p)
> F
         A          B          D          F         GB          I        SLO 
0.07142857 0.21428571 0.35714286 0.71428571 0.78571429 0.92857143 1.00000000 
> f
t
  A   B   D   F  GB   I SLO 
  1   2   2   5   1   2   1 
> epd <- function(x) (f <- table(t))/sum(f)
> epd(t)
t
         A          B          D          F         GB          I        SLO 
0.07142857 0.14285714 0.14285714 0.35714286 0.07142857 0.14285714 0.07142857 



Back to Data

ru/7iss/labs/s/s1.txt · Last modified: 2017/06/19 12:12 by vlado
 
Except where otherwise noted, content on this wiki is licensed under the following license: CC Attribution-Noncommercial-Share Alike 3.0 Unported
Recent changes RSS feed Donate Powered by PHP Valid XHTML 1.0 Valid CSS Driven by DokuWiki