Advertisement
Guest User

Untitled

a guest
Jun 24th, 2018
150
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.95 KB | None | 0 0
  1.  
  2. library(plyr)
  3. library(stats)
  4. library(ggplot2)
  5. library(moments)
  6. library(psych)
  7. library(car)
  8. library(fitdistrplus)
  9.  
  10. data("Prestige")
  11.  
  12. stat<-as.data.frame(matrix(c(
  13.  
  14. mean(Prestige$prestige),
  15. length(Prestige$prestige),
  16. min(Prestige$prestige),
  17. max(Prestige$prestige) ,
  18. range=max(Prestige$prestige)-min(Prestige$prestige) ,
  19. sd(Prestige$prestige) ,
  20. median(Prestige$prestige),
  21. quantile(Prestige$prestige, probs=0.25),
  22. quantile(Prestige$prestige, probs=0.75),
  23. skewness(Prestige$prestige),
  24. kurtosis(Prestige$prestige),
  25. IQR(Prestige$prestige),
  26. mean(Prestige$prestige, trim=0.05),
  27. mean(Prestige$prestige, trim=0.1),
  28. winsor.mean(Prestige$prestige, trim=0.05),
  29. winsor.mean(Prestige$prestige, trim=0.1)
  30. ), nrow=1)
  31. )
  32.  
  33. colnames(stat)<-c("mean", "length", "min", "max", "range", "sd", "median", "q25", "q75", "skewness", "kurtosis", "IQR",
  34. "mean 0.05", "mean 0.1", "wins 0.05", "wins 0.1")
  35.  
  36.  
  37.  
  38. #dopasowanie rozkladu
  39.  
  40. qplot(Prestige$prestige, geom="histogram", xlab = "prestige")
  41.  
  42.  
  43. plot(density(Prestige$prestige), main ="Gęstość zmiennej prestige")
  44.  
  45.  
  46. stat2<-fitdist(Prestige$prestige, "norm")
  47.  
  48. plot(fitdist(Prestige$prestige, "norm", "mle"))
  49.  
  50. plot(fitdist(Prestige$prestige, "norm","mge"))
  51.  
  52. cor(Prestige$prestige, Prestige$education)
  53. cor(Prestige$prestige, Prestige$income)
  54.  
  55.  
  56. ks.test(Prestige$prestige, "pnorm", mean=46.83333, sd=17.11994)
  57.  
  58.  
  59.  
  60. limits<-c(0, 10, 20, 30, 40, 50, 60, 70, 80, 90, 100)
  61. table<-classIntervals(Prestige$prestige,n=9, style="fixed", fixedBreaks=limits, intervalClosure = 'right')
  62.  
  63.  
  64. plot(table, pal=rainbow(length(limits) - 1), main='Prestige', xlab='Współczynnik prestiżu', ylab='procent zawodów')
  65.  
  66.  
  67. jenks.tests(table)
  68.  
  69.  
  70.  
  71. #-----------regresja----------------------------------------------------------------------
  72.  
  73.  
  74. scatterplot(x=Prestige$income, y=Prestige$prestige, main="Income ~ Education")
  75.  
  76.  
  77. scatter.smooth(x=Prestige$income, y=Prestige$education, main="Income ~ Education")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement