Advertisement
epiphytools

sas_a3_hist

Apr 16th, 2015
217
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. /* HISTOGRAMAS EM SAS (slide 16) */
  2.  
  3. data work.A1;
  4. input dap;
  5. if dap ge 5 and dap le 8.9 then classe=1;
  6. if dap ge 9 and dap le 12.9 then classe=2;
  7. if dap ge 13 and dap le 16.9 then classe=3;
  8. if dap ge 17 and dap le 20.9 then classe=4;
  9. if dap ge 21 and dap le 24.9 then classe=5;
  10. if dap ge 25 and dap le 28.9 then classe=6;
  11. datalines;
  12. 20.5
  13. 19.5
  14. 15.6
  15. 24.1
  16. 9.9
  17. 15.4
  18. 12.7
  19. 5.4
  20. 17.0
  21. 28.6
  22. 16.9
  23. 7.8
  24. 23.3
  25. 11.8
  26. 18.4
  27. 13.4
  28. 14.3
  29. 19.2
  30. 9.2
  31. 16.8
  32. 8.8
  33. 22.1
  34. 20.8
  35. 12.6
  36. 15.9
  37. ;
  38. proc sort data=A1;
  39. by classe;
  40. run;
  41.  
  42. proc means data=A1 noprint;
  43. by classe; var dap;
  44. output out=B1 n = freq_abs; run;
  45. proc print data=B1; run;
  46.  
  47.  
  48. title 'Histograma de dap';
  49. ods graphics off;
  50. proc univariate data=a1;
  51. histogram / normal(color=red fill mu=est sigma=est);
  52. var dap;
  53. inset n = 'Sample Size'
  54. normal / pos=ne cfill=blank;
  55. run;
  56. ods graphics off;
  57.  
  58. title 'Histograma de dap';
  59. ods graphics on;
  60. proc univariate data=a1;
  61. histogram / normal(color=red fill mu=est sigma=est);
  62. var dap;
  63. inset n = 'Sample Size'
  64. normal / pos=ne cfill=blank;
  65. run;
  66. ods graphics off;
  67.  
  68.  
  69. ------------------------------
  70. Regra de Scott
  71. k = 3,5 * s * n^(-1/3) ( s = desvio padrão dos dados).
  72. Amplitude de classe:
  73. w = (max-min) / k
  74.  
  75. Media ponderada:
  76. x_w = ∑ w_i * x_i / ∑ w_i
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement