Você está na página 1de 22

DISTRIBUCIN UNIFORME DISCRETA

3-76 Let the random variable X have a discrete uniform distribution on the
integers 0X99. Determine the mean and variance of X

x=seq(0,99,1)
mean(x)
sd(x)
----------------
mean(x) = 49.5
sd (x)=29.01149

3-77 Let the random X have a discrete uniform distribution on the integers
1X3. Determine the mean and variance of X

x=seq(1,3,1)
mean(x)
sd(x)
----------
mean(x)= 2
sd(x)= 1

3-78 Thickness measurements of a coating process are made to the nearest


hundredth of a millimeter. The thickness measurements are uniformly
distributed with values 0.15,0.16,0.17,0.18, and 0.19. Determine the mean and
variance of the coating thickness for this process.

x=seq(0.15,0.19,1)
mean(x)
sd(x)
----------------
mean(x)= 0.15
sd(x)= NA

1
DISTRIBUCIN BINOMIAL

3-92 Let X be a binomial random variable with p=0.2 and n=20. Use the
binomial table in Appendix A to determine the following probabilities.

a) P(X3)

prob1<-sum(dbinom(0:3,20,0.2))
prob1
-------------
prob1= 0.4114489

b) P(X>10)

prob2<-sum(dbinom(0:9,20,0.2))
1-prob2
-----------------------
1-prob2= 0.002594827

c) P(X=6)

dbinom(6,20,0.2)
----------------
0.1090997

d) P(6x11)

prob3=pbinom(11,20,0.2)-pbinom(5,20,0.2)
prob3
--------------------
prob3= 0.1956905

3-93 Let X be a binomial random variable with p=0.1 and n=10. Calculate the
following probabilities from the binomial probability mass function and from the
binomial table in Appendix A and compare results.

a) P(X2)
prob1<-sum(dbinom(0:2,10,0.1))
prob1
------------------
prob1= 0.9298092

b) P(X>8)
prob2<-sum(dbinom(0:7,10,0.1))
1-prob2
-----------------------
1-prob2= 3.736e-07

2
c) P(X=4)

dbinom(4,10,0.1)
----------------
0.01116026

d) P(5x7)
prob3=pbinom(7,10,0.1)-pbinom(4,10,0.1)
prob3
--------------------
prob3= 0.001634564

3
DISTRIBUCIN GEOMTRICA Y BINOMIAL NEGATIVA

3-120 Suppose that the random variable X has a geometric distribution with a
mean of 2.5. Determine the following probabilities:
a) P(X=1)

dgeom(0,(1/2.5))
----------------------
0.4

b) P(X=4)

dgeom(3,(1/2.5))
-------------------------
0.0864

c) P(X=5)

dgeom(4,(1/2.5))
---------------------------
0.05184

d) P(X3)

dgeom(0, (1/2.5))+dgeom(1, (1/2.5))+dgeom(2, (1/2.5))


--------------------
0.784

e) P(X>3)

pgeom(2, (1/2.5), lower.tail = F)

other form
1- (dgeom(0, (1/2.5))+dgeom(1, (1/2.5))+dgeom(2, (1/2.5)))

----------------------------------------------
0.216

3-122 Suppose that X is a negative binomial random variable with p=0.2 and
r=4. Determine the following:

a) E(X)

(4/0.2)
----------------
20
b) P(X=20)

dnbinom(20-4,4,prob=0.2)
--------------

4
0.04363988
c) P(X=19)
dnbinom(19-4,4,prob=0.2)
--------------------------
0.04593672

d) P(X=21)

dnbinom(21-4,4,prob=0.2)
-----------------
0.04107283

e) The most likely value for X

X=21 because, it has the lowest probability that is defectuose (0.04107283)

5
DISTRIBUCIN POISSON

3-157 Suppose that X has a Poisson distribution with a mean of 4. Determine


the following probabilities, ms grfica:

a) P(X=0)

dpois(0,4)
------------------------
0.01831564

b) P(X2)

prob<-ppois(2,4)
prob
-------------------------
0.2381033

c) P(X=4)

dpois(4,4)
----------------------
0.1953668

d) P(X=8)

dpois(8,4)
------------------------
0.02977018

6
Poisson Distribution: Mean=4
0.20
0.15
Probability Mass

0.10
0.05
0.00

0 2 4 6 8 10 12

3-158 Suppose that X has a Poisson distribution with a mean of 0.4. Determine
the following probabilities, ms grfica:

a) P(X=0)

dpois(0,0.4)
------------------------
0.67032

b) P(X2)

prob<-ppois(2,0.4)
prob
---------------------------
0.9920737

c) P(X=4)
dpois(4,0.4)
---------------------
0.000715008

7
d) P(X=8)

dpois(8,0.4)
-----------------------------
1.089536e-08

Poisson Distribution: Mean=0.4


0.6
0.5
Probability Mass

0.4
0.3
0.2
0.1
0.0

0 1 2 3 4

3-160 The number of telephone calls that arrive at pone exchange is often
modeled as a Poisson random variable. Assume that on the average there are
10 calls per hour.

a) What is the probability that there are exactly 5 calls in one hour?

dpois(5,10)
----------------------
0.03783327

b) What is the probability that there are 3 or fewer calls in one hour?

dpois(3,10)

8
---------------------
0.007566655

c) What is the probability that there are exactly 15 calls in two hours?

dpois(15,20)
-----------------------
0.05164885

d) What is the probability that there are exactly 5 calls in 30 minutes?


dpois(5,5)
----------------------
0.1754674

9
CASO 2 DISTRIBUCIN POISSON

Una cierta rea de Estados Unidos es afectada, en promedio por 6 huracanes


al ao. Encuentre la probabilidad de que en un determinado ao esta rea sea
afectada por:

a) Menos de 4 huracanes

ppois(3,6)
------------------
0.1512039

b) Entre 6 y 8 huracanes

p=ppois(8,6)-ppois(5,6)
p
------------------------------
0.4015579

c) Represente la funcin de probabilidad de la variable aleatoria que mide el


nmero de huracanes por ao.

Poisson Distribution: Mean=6


0.15
Probability Mass

0.10
0.05
0.00

0 5 10 15

10
CASO 3 DISTRIBUCIN HIPERGEOMTRICA

En un juego se disponen 15 globos llenos de agua, de los que 4 tienen premio.


Los participantes en el juego, con los ojos vendados, golpean los globos con un
palo por orden hasta que cada uno consigue romper 2.

a) Cul es la probabilidad de que el primer participante consiga un premio?

dhyper(0:2,11,4,2)
------------------------
0.05714286 0.41904762 0.52380952

b) Construya la grfica de la funcin de distribucin.

data.frame(prob=dhyper(0:2,11,4,2))
-------------------------------
prob
1 0.05714286
2 0.41904762
3 0.52380952

Hypergeometric Distribution: m=11, n=4, k=2


0.5
0.4
Probability Mass

0.3
0.2
0.1

0.0 0.5 1.0 1.5 2.0

Number of White Balls in Sample

c) Si el primer participante ha conseguido slo un premio, Cul es la


probabilidad de que el segundo participante consiga otro?

11
dhyper(0:1,10,3,2)
--------------------------------
0.03846154 0.38461538

12
DISTRIBUCIN DE FUNCIONES ACUMULATIVAS (FALTA RESOLVER NO
SE ENTENDIO)

4-35 Suppose that f(x)=0.25 for 0<x<4. Determine the mean and variance of X.

4-36 Suppose that f(x)=0.125 for 0<x<4. Determine the mean and variance of
X.

VARIABLE ALEATORIA CONTINUA UNIFORME (FALTA RESOLVER NO SE


ENTENDIO)

4-50 Suppose that X has a continuous uniform distribution over the interval
[1..5,5.5]. Determine the following:

a) Mean, variance and standard deviation of X


b) P(X<2.5)
c) Cumulative distribution function

13
VARIABLE ALEATORIA CONTINUA-DISTRIBUCIN NORMAL

4-72 The time until recharge for a battery in a laptop computer under common
conditions is normally distributed with a mean of 260 minutes and a standard
deviation of 50 minutes.

a) What is the probability that a battery lasts more than four hours?

prob<-pnorm(4,260,50)
1-prob
----------------------------
0.9999998

b) What are the quartiles (the 25% and 75% values) of battery life?

qnorm(0.25,260,50)
qnorm(0.75,260,50)
-----------------------------
226.2755
293.7245

c) What value of life in minutes is exceded with 95% probability?

qnorm(0.96,260,50)
-----------------------
347.5343

14
INFERENCIA CLSICA EN POBLACIONES NORMALES

5.1 Utilizando el fichero de datos peso altura.dat realice los siguientes


ejercicios:

a) Obtenga el intervalo de confianza del 90% para la altura de las mujeres.

with(ejer5.1, t.test(ALTURA[SEXO=="Mujer"], conf.level=0.90))


-------------------------------
One Sample t-test

data: ALTURA[SEXO == "Mujer"]


t = 204.31, df = 45, p-value < 2.2e-16
alternative hypothesis: true mean is not equal to 0
90 percent confidence interval:
169.5944 172.4056
sample estimates:
mean of x
171

b) Obtenga los intervalos del 95% para el peso de hombres y mujeres.

with(ejer5.1, t.test(PESO[SEXO=="Varn"], conf.level=0.95))


with(ejer5.1, t.test(PESO[SEXO=="Mujer"], conf.level=0.95))
------------------------------------
One Sample t-test

data: PESO[SEXO == "Varn"]


t = 60.332, df = 53, p-value < 2.2e-16
alternative hypothesis: true mean is not equal to 0
95 percent confidence interval:
83.37366 89.10782
sample estimates:
mean of x
86.24074

One Sample t-test

data: PESO[SEXO == "Mujer"]


t = 104.62, df = 45, p-value < 2.2e-16
alternative hypothesis: true mean is not equal to 0
95 percent confidence interval:
65.66746 68.24558
sample estimates:
mean of x
66.95652

15
c) Para un nivel de confianza del 99% contraste si la media de la altura de las
mujeres es mayor o igual a 173 cms y la de los hombres menor o igual a 175
cms. Puede indicar la razn de este aparente contrasentido?

with(ejer5.1, t.test(ALTURA[SEXO=="Mujer"], alternative ="l", mu=173,


conf.level=0.99))

with(ejer5.1, t.test(ALTURA[SEXO=="Varn"], alternative ="g",


mu=175,conf.level=0.99))
----------------------------
One Sample t-test

data: ALTURA[SEXO == "Mujer"]


t = -2.3896, df = 45, p-value = 0.01056
alternative hypothesis: true mean is less than 173
99 percent confidence interval:
-Inf 173.0188
sample estimates:
mean of x
171

One Sample t-test

data: ALTURA[SEXO == "Varn"]


t = 2.2677, df = 53, p-value = 0.01372
alternative hypothesis: true mean is greater than 175
99 percent confidence interval:
174.8769 Inf
sample estimates:
mean of x
177.1296

5.2 Para estudiar la diferencia de estaturas medias, medidas en centmetros,


de estudiantes varones en las facultades de ciencias de Cdiz y Mlaga, se
toma una muestra aleatoria de 15 estudiantes en cada facultad, obtenindose:

Obtenga el intervalo de confianza al 99% para la diferencia de estaturas


medias entre ambos colectivos de estudiantes. Se supone que las estaturas
siguen una distribucin normal.

Cadiz<-scan ()
Malaga<-scan()

16
var.test (Cadiz, Malaga)

t.test(Cadiz, Malaga, var.equal = T, conf.level = 0.99)


---------------------------------
F test to compare two variances

data: Cadiz and Malaga


F = 0.97449, num df = 14, denom df = 14, p-value = 0.9621
alternative hypothesis: true ratio of variances is not equal to 1
95 percent confidence interval:
0.3271665 2.9026155
sample estimates:
ratio of variances
0.9744939

Two Sample t-test

data: Cadiz and Malaga


t = 0.15154, df = 28, p-value = 0.8806
alternative hypothesis: true difference in means is not equal to 0
99 percent confidence interval:
-4.595818 5.129151
sample estimates:
mean of x mean of y
173.9333 173.6667

5.3 Se est realizando un estudio sobre la evolucin del nivel de colesterol de


las personas, para lo cual se seleccionan 10 individuos al azar y se les somete
a una nueva dieta alimenticia durante seis meses, tras la cual se les volvi a
medir el nivel de colesterol en mg/dl. Suponiendo normalidad, obtenga un
intervalo de confianza al 90% para la diferencia de medias.

antes<-scan()
despus<-scan()
t.test(antes,despues,var.equal=T,conf.level=0.90)
------------------------------------------
Two Sample t-test

data: antes and despues


t = 0.69203, df = 18, p-value = 0.4977
alternative hypothesis: true difference in means is not equal to 0
90 percent confidence interval:
-15.96094 37.16094
sample estimates:

17
mean of x mean of y
217.1 206.5

5.4 Una fbrica produce barras de hierro cuya longitud sigue una distribucin
Normal. A partir de la muestra:

100, 9 101, 2 100, 2 100,4 99, 8


100, 1 101, 5 100, 4 101,7 99, 5.

a) Encuentre un intervalo de confianza para la longitud media.

prodbarr<-scan()
t.test(prodbarr,var.equal=T,conf.level=0.90)
----------------------------------
One Sample t-test

data: prodbarr
t = 435.44, df = 9, p-value < 2.2e-16
alternative hypothesis: true mean is not equal to 0
90 percent confidence interval:
100.1466 100.9934
sample estimates:
mean of x
100.57

b) Tras revisar la maquinaria, se obtuvo una nueva muestra:

99.7 100.7 97.8 98.8 101.4


100.3 98.7 101.1 99.4 99.5

Estudie si se produjo algn cambio en la longitud media de la barras.

prodbarr2<-scan()
t.test(prodbarr2,var.equal=T,conf.level=0.90)
-----------------------------------------------
One Sample t-test

data: prodbarr2
t = 276.11, df = 9, p-value < 2.2e-16
alternative hypothesis: true mean is not equal to 0
90 percent confidence interval:
99.07782 100.40218
sample estimates:
mean of x
99.74
Si existe cambio en la longitud media de la barra una diferencia de 0.83 con
respecto a la anterior

18
5.5 Una empresa de transporte de mercancas tiene dos oficinas en una
determinada ciudad. Al objeto de asignar un nuevo trabajador a una de las dos
oficinas, la direccin de la empresa decide analizar la productividad de cada
una de ellas, contabilizndose las facturaciones en los ltimos doce meses
(miles de euros).

Suponiendo la normalidad de ambas poblaciones, existen diferencias de


facturacin entre las dos oficinas?

ofi1<-scan()
of2<-scan()

t.test(of1,of2,alternative="g",conf.level=0.95, paired=T)
-------------------------------------------
Paired t-test

data: of1 and of2


t = 2.1948, df = 11, p-value = 0.02527
alternative hypothesis: true difference in means is greater than 0
95 percent confidence interval:
0.228701 Inf
sample estimates:
mean of the differences
1.258333

El p-value > 0.001, en consecuencia se acepta la hiptesis nula, se concluye


que no existe diferencias de facturacin entre las dos oficinas.

5.6 Una empresa le propone al director de una fbrica un nuevo mtodo que,
supuestamente, reduce el tiempo empleado en el montaje de uno de sus
productos. Con el propsito de comparar tal mtodo con el empleado
habitualmente, seleccion aleatoriamente a siete de sus empleados para que
llevasen a cabo el montaje con los dos sistemas y anoto los tiempos
empleados en el montaje, obteniendo los siguientes resultados:

Supuesto que el tiempo de montaje sigue una distribucin Normal, se puede


afirmar que efectivamente el nuevo mtodo reduce el tiempo en ms de dos
minutos?

19
methab<-scan()
metnuev<-scan()
t.test(methab,metnuev,alternative="g",conf.level=0.95, paired=T)
t.test(methab,metnuev,alternative="g",conf.level=0.85, paired=T,mu=2)
---------------------------------------------------
Paired t-test

data: methab and metnuev


t = 3.1275, df = 6, p-value = 0.01019
alternative hypothesis: true difference in means is greater than 0
95 percent confidence interval:
1.78523 Inf
sample estimates:
mean of the differences
4.714286

Paired t-test

data: methab and metnuev


t = 1.8007, df = 6, p-value = 0.06092
alternative hypothesis: true difference in means is greater than 2
85 percent confidence interval:
3.004712 Inf
sample estimates:
mean of the differences
4.714286
En este caso se tiene un p-value= 0.01 (decisin del investigador), se decide
rechazar la hiptesis nula, es decir que existe diferencias entre el mtodo
habitual y el mtodo nuevo con un nivel de significancia de = 0.05, adems se
tiene que p-value>0.01 se acepta la hiptesis nula, es decir el nuevo mtodo no
reduce el tiempo en ms de dos minutos.

20
INFERENCIA NO PARAMTRICA.

6.1 Contraste la normalidad de la variable separacin entre las espirales


(Separ) del fichero caracoles.dat.

shapiro.test(Datasetcaracol$Separ)
------------------------------------
Shapiro-Wilk normality test

data: Datasetcaracol$Separ
W = 0.84025, p-value = 0.003675

El p-value <0.01, se rechaza la hiptesis nula, es decir los datos de la variable


Separ se distribuyen de manera anormal.

6.2 Mediante el test de Kolmogorov-Smirnov, compruebe la hiptesis de


igualdad de las funciones de distribucin emprica de dos muestras de tamao
200, procedentes de poblaciones N(0;1) y N(0;1,3) previamente generadas.

no se pudo encontrar la funcin "Ks.test"

6.3 Compruebe la hiptesis de normalidad de la velocidad para cada una de las


ubicaciones en el fichero parque eolico.dat.

no se pudo encontrar la funcin "Ks.test"

6.4 Contraste la hiptesis de que los datos siguientes, generados


aleatoriamente mediante ordenador, procedan de una distribucin Uniforme en
el intervalo [0, 1] con un nivel de significacin = 0,05.

0. 582 0.501 0.497 0.026 0.132 0.561


0.642 0.994 0.948 0.081 0.179 0.619

aleord<-scan()
shapiro.test(aleord)
------------------------------
Shapiro-Wilk normality test

data: aleord
W = 0.31281, p-value = 5.178e-07

El p-value <0.01, se rechaza la hiptesis nula, es decir los datos de la variable


Separ se distribuyen de manera anormal.

21
22

Você também pode gostar