Documentos de Académico
Documentos de Profesional
Documentos de Cultura
1. PASO PRELIMINAR
tr=c(3,4,5,3,4,5,4,3,2,3,12,11,3,4,89)
2. ESTADÍSTICOS DESCRIPTIVOS
La mediana
median(tr)
La (cuasi)desviación típica
sd(tr)
la media recortada al 5%
mean(tr,trim=5/100)
https://www.uv.es/mperea/r_ejemplo.htm 1/4
7/22/23, 1:50 AM Estadísticos y gráficos en R
skewness=function(x) {
m3=mean((x-mean(x))^3)
skew=m3/(sd(x)^3)
skew}
y pedirla:
skewness(tr)
skew2=function(x) {
num=(p75-p50)-(p50-p25)
den=p75-p25
skewinter=num/den
skewintwer}
y pedirlo:
skew2(tr)
y pedirla:
kurtosis(tr)
fivenum(tr)
summary(tr)
que nos da el mínimo, el máximo, los 3 cuartiles (P25, P50 y P75) y la media.
3. GRÁFICOS
stem(tr)
boxplot(tr)
hist(tr)
https://www.uv.es/mperea/r_ejemplo.htm 2/4
7/22/23, 1:50 AM Estadísticos y gráficos en R
***************************
tr=c(3,4,5,3,4,5,4,3,2,3,12,11,3,4,89)
length(tr)
mean(tr)
median(tr)
sd(tr)
IQR(tr)
mad(tr)
fivenum(tr)
summary(tr)
p25=quantile(tr,.25)
p25
p50=quantile(tr,.50)
p50
p75=quantile(tr,.75)
p75
mean(tr,trim=10/100)
kurtosis=function(x) {
m4=mean((x-mean(x))^4)
kurt=m4/(sd(x)^4)-3
kurt}
kurtosis(tr)
skewness=function(x) {
m3=mean((x-mean(x))^3)
skew=m3/(sd(x)^3)
skew}
skewness(tr)
skew2=function(x) {
num=(p75-p50)-(p50-p25)
den=p75-p25
skewinter=num/den
skewinter}
skew2(tr)
stem(tr)
boxplot(tr)
hist(tr)
*****************************
Rweb:> tr=c(3,4,5,3,4,5,4,3,2,3,12,11,3,4,89)
Rweb:> length(tr)
[1] 15
Rweb:> mean(tr)
[1] 10.33333
Rweb:> median(tr)
[1] 4
Rweb:> sd(tr)
[1] 21.95341
Rweb:> IQR(tr)
[1] 2
Rweb:> mad(tr)
[1] 1.4826
Rweb:> fivenum(tr)
[1] 2 3 4 5 89
Rweb:> summary(tr)
Min. 1st Qu. Median Mean 3rd Qu. Max.
https://www.uv.es/mperea/r_ejemplo.htm 3/4
7/22/23, 1:50 AM Estadísticos y gráficos en R
https://www.uv.es/mperea/r_ejemplo.htm 4/4