title: Kruskal-wallis in R
body: <p>I have tried to perform the Kruskal-Wallis test, but I am not sure if the data is ordered correctly, therefore, I do not know if the result is correct.</p>
  <p>I still do not know how to verify that it is correct, I do not know if you can help me identify the error.</p>
  <p>Thank you.</p>
  <p>Data:<br />
  There are 13 samples and 138 observation, divided by months.</p>
  <pre><code>             ï..meses fajerae
              1     ene-15       0
              2     ene-15       1
              3     ene-15       0
              4     ene-15       0
              5     ene-15       0
              6     ene-15       0
              7     ene-15       1
              8     ene-15       1
              9     ene-15       0
              10    ene-15       1
              11    feb-15       0
              12    feb-15       0
              13    feb-15       0
              14    feb-15       1
              15    feb-15       0
              16    feb-15       1
              17    feb-15       1
              18    feb-15       0
              19    feb-15       0
              20    feb-15       3
              21    feb-15       2
              22    feb-15       2
              23    feb-15       0
              24    feb-15       0
              25    feb-15       1
              26    mar-15       1
              27    mar-15       0
              28    mar-15       3
              29    mar-15       3
              30    mar-15       1
              31    mar-15       4
              32    mar-15       2
              33    mar-15       5
              34    mar-15       0
              35    mar-15       1
  </code></pre>
  <p>Here I do the Kruskal-Wallis test.</p>
  <pre><code>#kruskal-wallis test
    
  setwd(&quot;~/&quot;)
  
  datos &lt;- read.csv(file.choose(), header = TRUE)
  datos
  
  
  #estructura de los datos
  str(datos)
  attach(datos)
  names(datos)
  class(datos)
  factor(datos)
  </code></pre>
  <p>Here it does not recognize the levels, the results are null, I expected it to show me the months, ene-15, Feb-15, Mar-15, Nov-15, etc.</p>
  <pre><code>levels(datos$ï..meses)
  </code></pre>
  <p>But in the table, it's correct.</p>
  <pre><code>table(datos$ï..meses)
  
      abr-17 dic-15 dic-16 dic-17 ene-15 ene-16 ene-17 ene-18 feb-15 feb-16 mar-15 
          10     10     10     12     10     10     13     20     15      2     10 
      mar-17 nov-15 
           4     12
  </code></pre>
  <p>I did the homocedasticity test</p>
  <pre><code># Homocedasticidad: la varianza debe de ser constante entre todos los grupos.
   
   leveneTest(fajerae ~ ï..meses, data = matriz, center = &quot;median&quot;)
   
   #Results#
   Levene's Test for Homogeneity of Variance (center = &quot;median&quot;)
         Df F value  Pr(&gt;F)  
    group  12  1.8447 0.04784 *
          125                  
    ---
   Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
    Warning message:
    In leveneTest.default(y = y, group = group, ...) : group coerced to factor.
  </code></pre>
  <p>And the Kruskal-Wallis test, which gave me a result, but I don't know how to check if it is correct.</p>
  <pre><code>    kruskal.test(fajerae ~ ï..meses, data = matriz)
  
  #Results# 
  Kruskal-Wallis rank sum test
  data:  fajerae by ï..meses 
  Kruskal-Wallis chi-squared = 24.493, df = 12, p-value = 0.01742
  </code></pre>