Los datos son:
#Sueldo
sueldo<- c(1200,1065,2500,4000,2300,700,800,950,1100,1500,800,800,750,700,1600)
#Opcion 1
promedio = sum(sueldo)/length(sueldo)
promedio
## [1] 1384.333
#Opcion 2
mean(sueldo)
## [1] 1384.333
median(sueldo)
## [1] 1065
#Opcion 1
table(sueldo)
## sueldo
## 700 750 800 950 1065 1100 1200 1500 1600 2300 2500 4000
## 2 1 3 1 1 1 1 1 1 1 1 1
#Opcion 2
library(modeest)
mfv(sueldo)
## [1] 800
Rango = Valor máximo – Valor mínimo
#Opcion 1
rango = max(sueldo) - min(sueldo)
rango
## [1] 3300
#Opcion 2
range(sueldo)
## [1] 700 4000
\(s^2=\frac{\sum_{i=1}^n\left(x_i-\bar{x}\right)^2}{n-1}\)
#Opcion 1
sqrt(var(sueldo))
## [1] 916.2635
#Opcion 2
sd(sueldo)
## [1] 916.2635
\[cv=\frac{s}{\bar{x}}\times100\]
coef_var <-sd(sueldo)/ mean(sueldo)*100
coef_var
## [1] 66.18807
summary(sueldo)
## Min. 1st Qu. Median Mean 3rd Qu. Max.
## 700 800 1065 1384 1550 4000
library(psych)
describe(sueldo)
## vars n mean sd median trimmed mad min max range skew kurtosis
## X1 1 15 1384.33 916.26 1065 1235.77 467.02 700 4000 3300 1.6 1.74
## se
## X1 236.58
Los datos son:
#GASTOS
gasto <- c(840,1200,100,150,360,420,120,2000,700,500,260,120,180,300,480,220)
#Opcion 1
promedio = sum(gasto)/length(gasto)
promedio
## [1] 496.875
#Opcion 2
mean(gasto)
## [1] 496.875
median(gasto)
## [1] 330
#Opcion 1
table(gasto)
## gasto
## 100 120 150 180 220 260 300 360 420 480 500 700 840 1200 2000
## 1 2 1 1 1 1 1 1 1 1 1 1 1 1 1
#Opcion 2
library(modeest)
mfv(gasto)
## [1] 120
Rango = Valor máximo – Valor mínimo
#Opcion 1
rango = max(gasto) - min(gasto)
rango
## [1] 1900
#Opcion 2
range(gasto)
## [1] 100 2000
\(s^2=\frac{\sum_{i=1}^n\left(x_i-\bar{x}\right)^2}{n-1}\)
#Opcion 1
sqrt(var(gasto))
## [1] 501.4342
#Opcion 2
sd(gasto)
## [1] 501.4342
\[cv=\frac{s}{\bar{x}}\times100\]
coef_var <-sd(gasto)/ mean(gasto)*100
coef_var
## [1] 100.9176
summary(gasto)
## Min. 1st Qu. Median Mean 3rd Qu. Max.
## 100.0 172.5 330.0 496.9 550.0 2000.0
library(psych)
describe(gasto)
## vars n mean sd median trimmed mad min max range skew kurtosis
## X1 1 16 496.88 501.43 330 417.86 259.46 100 2000 1900 1.74 2.4
## se
## X1 125.36