daily pastebin goal
46%
SHARE
TWEET

do prva pod D

a guest Feb 17th, 2019 73 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #Exercise 1
  2.   #a)
  3. x=rbinom(100,5,1/2)
  4. x
  5.   #b)
  6. min(x); max(x); mean(x); sd(x); quantile(x); IQR(x); range(x);
  7. library(Hmisc)
  8. describe(x)
  9. summary(x)
  10. our.mode = function(x)
  11. {
  12.   ux = unique(x)
  13.   tab = tabulate(match(x,ux))
  14.   ux[tab==max(tab)]
  15. }
  16. m = our.mode(x)
  17. m
  18.   #v)
  19. hist(x,freq=F,col="red", main="Histogram na X",xlab="Pronajdeni razliki")
  20. lines(density(x),col="blue", lwd=4)
  21. curve(dbinom(x,5,1/2), add=T, col="green",lwd=4)
  22.   #g)
  23. f1 = summary(as.factor(x))[["3"]]/100; f1
  24. f2 = dbinom(3,5,1/2); f2
  25. "Razlikata megju f1 i f2 e:"; abs(f1-f2);
  26.   #d)
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top