Introducción

A continuación presentremos un listado de las estadísticas descriptivas básicas para el análisis de datos y posteriormente veremos como realizar los cálculos con los códigos en R:

Estadísticas de Tendencia Central

  • Promedio
  • Mediana
  • Moda
#Generamos 100 datos aleatorios
x <- rnorm(100,5,2)
#Visualizamos los datos
print(x)
##   [1] 7.081162 5.660175 5.911340 5.571361 4.965753 3.259947 2.631444 3.388301
##   [9] 3.533485 6.856653 5.113204 5.925780 6.910659 3.441100 4.027870 7.406631
##  [17] 4.678781 3.230837 1.870258 2.935385 8.523472 2.015402 2.420954 7.841281
##  [25] 1.472541 4.237015 4.000620 3.728445 5.367599 3.281173 7.142326 3.189966
##  [33] 3.049540 3.128652 3.465270 3.958190 6.923714 4.893318 5.117252 5.343876
##  [41] 5.558249 4.087253 9.473665 3.621189 3.135010 4.186794 6.762446 3.818505
##  [49] 5.361396 7.908459 3.172331 6.254463 4.324885 7.411918 3.321960 3.608096
##  [57] 8.235549 5.800003 2.513818 4.264697 5.416294 5.633077 4.745162 5.172008
##  [65] 6.809231 3.415630 5.340947 1.246292 7.423303 5.921117 5.425524 3.863328
##  [73] 2.793285 8.551717 6.395911 5.349831 5.366861 5.482819 8.392901 3.000311
##  [81] 3.503750 2.869171 6.736073 5.553880 2.639298 5.785986 6.736177 1.689974
##  [89] 4.007420 5.274524 4.349359 3.044255 2.806348 4.547506 4.067628 2.324839
##  [97] 6.490125 5.221416 4.822215 6.664516
#Calculamos la media
mean(x)
## [1] 4.812014

Gráficos en R

A continuación mostraremos un ejemplo de como generar un histograma

hist(x, col="green")

This is an R Markdown document. Markdown is a simple formatting syntax for authoring HTML, PDF, and MS Word documents. For more details on using R Markdown see http://rmarkdown.rstudio.com.

When you click the Knit button a document will be generated that includes both content as well as the output of any embedded R code chunks within the document. You can embed an R code chunk like this:

summary(cars)
##      speed           dist       
##  Min.   : 4.0   Min.   :  2.00  
##  1st Qu.:12.0   1st Qu.: 26.00  
##  Median :15.0   Median : 36.00  
##  Mean   :15.4   Mean   : 42.98  
##  3rd Qu.:19.0   3rd Qu.: 56.00  
##  Max.   :25.0   Max.   :120.00

Including Plots

You can also embed plots, for example:

Note that the echo = FALSE parameter was added to the code chunk to prevent printing of the R code that generated the plot.