Download as pdf or txt
Download as pdf or txt
You are on page 1of 6

Tarea 1

2022-07-04

#1.2
l=c(8.9,12.4,8.6,11.3,9.2,8.8,NA,6.2,7.0,
7.1,11.8,10.7,7.6,9.1,9.2,8.2,9.0,8.7,
9.1,10.9,10.3,9.6,7.8,11.5,9.3,7.9,8.8,
8.8,12.7,8.4,7.8,5.7,10.5,10.5,9.6,8.9,
10.2,10.3,7.7,10.6,8.3,8.8,9.5,8.8,9.4)
datos=matrix(l,nrow=9,ncol=5)
datos

## [,1] [,2] [,3] [,4] [,5]


## [1,] 8.9 7.1 9.1 8.8 10.2
## [2,] 12.4 11.8 10.9 12.7 10.3
## [3,] 8.6 10.7 10.3 8.4 7.7
## [4,] 11.3 7.6 9.6 7.8 10.6
## [5,] 9.2 9.1 7.8 5.7 8.3
## [6,] 8.8 9.2 11.5 10.5 8.8
## [7,] NA 8.2 9.3 10.5 9.5
## [8,] 6.2 9.0 7.9 9.6 8.8
## [9,] 7.0 8.7 8.8 8.9 9.4
#a) Constuye un histograma de frecuencia relativa para estos datos (Sin incluir 35.1 en el intervalo)
library(fdth)

##
## Attaching package: 'fdth'
## The following objects are masked from 'package:stats':
##
## sd, var
tabla=fdt(l,breaks = "Sturges",exclude=max(datos),na.rm=TRUE)
tabla

## Class limits f rf rf(%) cf cf(%)


## [5.643,6.6693) 2 0.04 4.44 2 4.44
## [6.6693,7.6956) 3 0.07 6.67 5 11.11
## [7.6956,8.7219) 9 0.20 20.00 14 31.11
## [8.7219,9.7481) 17 0.38 37.78 31 68.89
## [9.7481,10.774) 7 0.16 15.56 38 84.44
## [10.774,11.801) 4 0.09 8.89 42 93.33
## [11.801,12.827) 2 0.04 4.44 44 97.78
hist(datos)

1
Histogram of datos
12
10
Frequency

8
6
4
2
0

6 8 10 12

datos
#1.8
x=c(21,21,45,45,46,47,47,48,50,57,57,67,68,71,84,86,89,90,92,93,96)
b=mean(x)
b

## [1] 62.85714
x_cen=x-b
x_cen

## [1] -41.857143 -41.857143 -17.857143 -17.857143 -16.857143 -15.857143


## [7] -15.857143 -14.857143 -12.857143 -5.857143 -5.857143 4.142857
## [13] 5.142857 8.142857 21.142857 23.142857 26.142857 27.142857
## [19] 29.142857 30.142857 33.142857
sum(x_cen)

## [1] 6.394885e-14
#1.12
becarios=143
investigador=64
docencia=becarios-investigador

#1.13
x1=sort(c(4,8,2,5,7,9))
mean(x1)

## [1] 5.833333
median(x1)

2
## [1] 6
#No hay moda
y=2*x1+3
y

## [1] 7 11 13 17 19 21
mean(y)

## [1] 14.66667
median(y)

## [1] 15
#No hay moda
z=2*x1-3
z

## [1] 1 5 7 11 13 15
mean(z)

## [1] 8.666667
median(z)

## [1] 9
#No hay moda

#1.54 Medidas de tendencia central y media armonica


x=sort(c(11,4,7,5,2,3,9,8,7,10))
x

## [1] 2 3 4 5 7 7 8 9 10 11
mean(x)

## [1] 6.6
library(modeest)

##
## Attaching package: 'modeest'
## The following object is masked from 'package:fdth':
##
## mfv
mfv(x)

## [1] 7
median(x)

## [1] 7
xgeo=(11*4*7*5*2*3*9*8*7)ˆ0.1
xgeo

## [1] 4.643124

3
xarm=length(x)/(1/11+1/4+1/7+1/5+1/2+1/3+1/9+1/8+1/7)
xarm

## [1] 5.274073
#1.58 Coeficiente de variacion
x=c(11,4,7,5,2,3,9,8,7)
x=sort(x)
x

## [1] 2 3 4 5 7 7 8 9 11
mean(x)

## [1] 6.222222
sd(x)

## [1] 2.948634
c_var=(sd(x)/mean(x))*100
c_var

## [1] 47.38877
#1.29 Diagramas de caja
x=c(15,36,36,43,45,53,56,61)
y=c(23,24,26,27,28,29,30,32)
z=c(4,9,12,12,16,24,35,46)
boxplot(x,main="Cantidad de SO2 (X)",horizontal=TRUE,col="RED")

Cantidad de SO2 (X)

20 30 40 50 60
boxplot(y,main="Cantidad de SO2 (Y)",horizontal=TRUE,col="BLUE")

4
Cantidad de SO2 (Y)

24 26 28 30 32
boxplot(z,main="Cantidad de SO2 (Z)",horizontal=TRUE,col="PURPLE")

Cantidad de SO2 (Z)

10 20 30 40
#Probabilidad
sum(x>25)/length(x)

## [1] 0.875
#1.28 Vector de medias de la muestra, la matriz de varianzas y covarianzas, y la matriz de Correlacion d
b1=c(43,36,45,61,53,15,36,36)
b2=c(28,26,29,32,27,23,30,24)
b3=c(12,9,46,35,24,4,16,12)

5
datos1=matrix(c(b1,b2,b3),nrow=length(b1),ncol=3)
datos1

## [,1] [,2] [,3]


## [1,] 43 28 12
## [2,] 36 26 9
## [3,] 45 29 46
## [4,] 61 32 35
## [5,] 53 27 24
## [6,] 15 23 4
## [7,] 36 30 16
## [8,] 36 24 12
medias=colMeans(datos1)
medias

## [1] 40.625 27.375 19.750


varianzas=var(datos1)
varianzas

## [,1] [,2] [,3]


## [1,] 187.69643 31.44643 138.03571
## [2,] 31.44643 9.12500 29.53571
## [3,] 138.03571 29.53571 205.35714
covarianzas=cov(datos1)
covarianzas

## [,1] [,2] [,3]


## [1,] 187.69643 31.44643 138.03571
## [2,] 31.44643 9.12500 29.53571
## [3,] 138.03571 29.53571 205.35714
correlacion=cor(datos1)
correlacion

## [,1] [,2] [,3]


## [1,] 1.0000000 0.7598483 0.7030862
## [2,] 0.7598483 1.0000000 0.6823012
## [3,] 0.7030862 0.6823012 1.0000000

You might also like