library(tigerstats)
\[\frac{(n-1)S^2}{\chi^2_{\alpha/2}}<\sigma^2<\frac{(n-1)S^2}{\chi^2_{1-\alpha/2}}\]
\[\sqrt{\frac{(n-1)S^2}{\chi^2_{\alpha/2}}}<\sigma<\sqrt{\frac{(n-1)S^2}{\chi^2_{1-\alpha/2}}}\]
\[\sqrt{\frac{(50-1)80.9^2}{33.93}}<\sigma<\sqrt{\frac{(50-1)S^2}{{66.33}}}\]
\[R//~(69.53~,~97.21)\]
punto2 <- c(35, 44, 38, 55, 33, 56, 67, 45, 48, 40)
punto2 <- data_frame(punto2)
## Warning: `data_frame()` was deprecated in tibble 1.1.0.
## Please use `tibble()` instead.
## This warning is displayed once every 8 hours.
## Call `lifecycle::last_lifecycle_warnings()` to see where this warning was generated.
Mediapunto2 <- mean(punto2$punto2)
varpunto2 <- var(punto2$punto2)
nPunto2 <- length(punto2$punto2)
chiPunto2 <- qchisq(0.05,nPunto2-1)
chiPunto22 <- qchisq((1-0.05),nPunto2-1)
Ncpunto2 <- 0.09
lsPunto2 <- round(((nPunto2-1)*varpunto2)/chiPunto2,2)
liPunto2 <- round(((nPunto2-1)*varpunto2)/chiPunto22,2)
print(paste("Itervalo de confianza para la Var es: ","(",liPunto2 ,",",lsPunto2,")" ))
## [1] "Itervalo de confianza para la Var es: ( 60.34 , 307.03 )"
\[H_0=\mu_h -\mu_m \leq 0 \\ H_a = \mu_h -\mu_m >0\]
\[Sp^2 = \frac{(99))(25000)^2+(59)(14000)^2}{158} \\ Sp=21559.30\]
\[t=\frac{1800000-1550000}{(21559.30)\sqrt{\frac{1}{100}+\frac{1}{60}}}=71.010\]
pt(71.010,lower.tail = F,158)
## [1] 4.309065e-122
ttestGC(mean = c(1800000,1550000),n=c(100,60),alternative = "greater",mu = 0,var.equal = T,conf.level = 0.90,sd=c(25000,14000),verbose = F)
##
##
## Inferential Procedures for the Difference of Two Means mu1-mu2:
## Results from summary data.
## 90% Confidence Interval for mu1-mu2:
##
## lower.bound upper.bound
## 246029.929291 Inf
##
## Test Statistic: t = 81.04
## Degrees of Freedom: 158
## P-value: P = 6.457e-131
Podemos rechazar la hipótesis nula y aceptamos la hipótesis alternativa, es decir, según el estudio realizado, los hombres en su defecto ganan más que las mujeres.
\[\mu = 11500 ~~~ n=60 ~~~ \sigma = 4000 ~~~ Nc = 0.95\] \[\bar{X} \pm Z_{\alpha/2}\frac{400}{\sqrt{60}} = \bar{X} \pm 1.95\frac{4000}{\sqrt{60}}\] Margen de Error: \(\$1006.97\)
Para obtener un margen de error de $500.
\[500 = 1.95\frac{4000}{\sqrt{n}}\] \[n=\left({\frac{1.95(4000)}{500}} \right)^2=243.36\] Para tener un margen de error del $500 se requiere tomar una muestra de 244 y que cumplan las mismas condiciones del estudio.
\[H_o : p=0.7 \\ H_a : p \neq 0.7 \] \[z=\displaystyle{\frac{p-\pi}{\sqrt{\frac{p(1-p)}{n}}}}\] \[z= \frac{0.7-0.77}{\displaystyle\sqrt{\frac{0.7(1-0.7)}{1200}}} = -5.29 \]
2*pnorm(-5.29)
## [1] 1.223164e-07
proptestGC(840 , n = 1200,conf.level = 0.95,alternative = "t",p = 0.77,verbose = F)
##
##
## Inferential Procedures for a Single Proportion p:
## Results based on Summary Data
## Continuity Correction Applied to Test Statistic
## 95% Confidence Interval for p:
##
## lower.bound upper.bound
## 0.674072 0.725928
##
## Test Statistic: z = -5.323
## P-value: P = 1.021e-07
Rechazamos la hipótesis nula y aceptamos la alternativa, es decir, podemos aceptar que la proporción es diferente a 0.77 e incluso la probabilidad de cometer el error tipo I es inferior a 1%.
\[H_o:\mu = 36800 \\H_a: \mu \neq 36800\]
ttestGC(mean =43800 ,conf.level = 0.90,n = 150,sd = 5500,mu = 36800,alternative = "t",verbose = F)
##
##
## Inferential Procedures for One Mean mu:
## 90% Confidence Interval for mu:
##
## lower.bound upper.bound
## 43056.719081 44543.280919
##
## Test Statistic: t = 15.59
## Degrees of Freedom: 149
## P-value: P = 4.181e-33
ttestGC(mean =43800 ,conf.level = 0.95,n = 150,sd = 5500,mu = 36800,alternative = "t",verbose = F)
##
##
## Inferential Procedures for One Mean mu:
## 95% Confidence Interval for mu:
##
## lower.bound upper.bound
## 42912.625598 44687.374402
##
## Test Statistic: t = 15.59
## Degrees of Freedom: 149
## P-value: P = 4.181e-33
ttestGC(mean =43800 ,conf.level = 0.99,n = 150,sd = 5500,mu = 36800,alternative = "t",verbose = F)
##
##
## Inferential Procedures for One Mean mu:
## 99% Confidence Interval for mu:
##
## lower.bound upper.bound
## 42628.265884 44971.734116
##
## Test Statistic: t = 15.59
## Degrees of Freedom: 149
## P-value: P = 4.181e-33
Sin importar el nivel de significancia que se tome, la probabilidad de cometer el error tipo I es muy pequeña, menor al 1% al tomar niveles de significancia del 10%,5% y 1 %
\[H_o:\mu = 12000 \\H_a: \mu > 12000\]
estadisZ <- function(xbar,mu,sdpoblacional,nmuestral){
mu = mu
xbar = xbar
sdpoblacional= sdpoblacional
nmuestral = nmuestral
rest = (xbar -mu)/(sdpoblacional/sqrt(nmuestral))
return(rest)
}
estadisZ(xbar = 138000,sdpoblacional = 3000,nmuestral = 15,mu = 12000 )
## [1] 162.6653
ttestGC(mean = 138000,mu = 12000,n = 15,sd = 3000,conf.level = 0.90,alternative = "g",verbose = F)
##
##
## Inferential Procedures for One Mean mu:
## 90% Confidence Interval for mu:
##
## lower.bound upper.bound
## 136958.143952 Inf
##
## Test Statistic: t = 162.7
## Degrees of Freedom: 14
## P-value: P = 1.212e-24
ttestGC(mean = 138000,mu = 12000,n = 15,sd = 3000,conf.level = 0.95,alternative = "g",verbose = F)
##
##
## Inferential Procedures for One Mean mu:
## 95% Confidence Interval for mu:
##
## lower.bound upper.bound
## 136635.695035 Inf
##
## Test Statistic: t = 162.7
## Degrees of Freedom: 14
## P-value: P = 1.212e-24
ttestGC(mean = 138000,mu = 12000,n = 15,sd = 3000,conf.level = 0.99,alternative = "g",verbose = F)
##
##
## Inferential Procedures for One Mean mu:
## 99% Confidence Interval for mu:
##
## lower.bound upper.bound
## 135967.075637 Inf
##
## Test Statistic: t = 162.7
## Degrees of Freedom: 14
## P-value: P = 1.212e-24
La hipótesis alternativa se acepta para cada uno de los niveles de significancia, es decir, el comprador puede asegurar con un 99.999% de confianza que su hipótesis es verdadera.