This is an R Markdown document. Markdown is a simple formatting syntax for authoring HTML, PDF, and MS Word documents. For more details on using R Markdown see http://rmarkdown.rstudio.com.
When you click the Knit button a document will be generated that includes both content as well as the output of any embedded R code chunks within the document. You can embed an R code chunk like this:
summary(cars)
## speed dist
## Min. : 4.0 Min. : 2.00
## 1st Qu.:12.0 1st Qu.: 26.00
## Median :15.0 Median : 36.00
## Mean :15.4 Mean : 42.98
## 3rd Qu.:19.0 3rd Qu.: 56.00
## Max. :25.0 Max. :120.00
You can also embed plots, for example:
Note that the echo = FALSE parameter was added to the
code chunk to prevent printing of the R code that generated the
plot.
1-pnorm(30,25.5,4.5)
## [1] 0.1586553
qnorm(0.95,25.5,4.5)
## [1] 32.90184
1-pnorm(40,35,3)
## [1] 0.04779035
x <-40
promedio <- 35
desviacion_estandar <- 3
x_densidad <- seq(promedio-3*desviacion_estandar, promedio+3*desviacion_estandar,length=1000)
y_densidad <- dnorm(x_densidad, promedio, desviacion_estandar)
plot(x_densidad,y_densidad,type ="l",lty=1, xlab="x", ylab="f(x)", main="Función de Densidad de Probabilidad (Normal)",col="maroon")
x_distribucion <- seq(promedio-3*desviacion_estandar, promedio+3*desviacion_estandar,length=1000)
y_distribucion <- pnorm(x_distribucion, promedio, desviacion_estandar)
plot(x_distribucion,y_distribucion,type ="l",lty=1, xlab="x", ylab="f(x)", main="Función de Distribución de Probabilidad (Normal)",col="purple")
0.0475*0.0475
## [1] 0.00225625
qnorm(1 - (1 - 0.95)/2)
## [1] 1.959964
35 - (1.9599 * 3)
## [1] 29.1203
35 + (1.9599 * 3)
## [1] 40.8797
qnorm(0.9)
## [1] 1.281552
1.2816*3+35
## [1] 38.8448
## PhantomJS not found. You can install it with webshot::install_phantomjs(). If it is installed, please make sure the phantomjs executable can be found via the PATH variable.
peso_diamante <- c(.46,.61,.52,.48,.57,.54)
promedio <- mean(peso_diamante)
desviacion_estandar_muestra1 <- sqrt(var(peso_diamante))
n <- 6
miu_o <- 0.5
t <- (promedio-miu_o)/(desviacion_estandar_muestra1/sqrt(n))
x_densidad1 <- seq(-4,4, length=1000)
y_densidad1 <- dt(x_densidad, df=5)
plot(x_densidad1, y_densidad1, type="l", lty=1,xlab="t", ylab="f(t)", main="Función de densidad de probabilidad (t de Student)")
x_distribucion1 <- seq(-4,4,length=1000)
y_distribucion1 <- pt(x_distribucion1, df=5)
plot(x_distribucion1, y_distribucion1, type="l", lty=1,xlab="t", ylab="f(t)", main="Función de distribución de probabilidad (t de Student)")
datos <- c(4.9, 5.1, 4.9, 5.0, 5.0, 4.7)
valor_objetivo <- 5
resultado <- t.test(datos, mu = valor_objetivo, alternative = "less", conf.level = 0.95)
resultado
##
## One Sample t-test
##
## data: datos
## t = -1.1952, df = 5, p-value = 0.1428
## alternative hypothesis: true mean is less than 5
## 95 percent confidence interval:
## -Inf 5.045727
## sample estimates:
## mean of x
## 4.933333
peso_diamante_con_error <- c(.46,.61,.52,.48,.57,54)
boxplot(peso_diamante_con_error, horizontal=TRUE)
library(DescTools)
peso_diamante_con_error <- c(.46,.61,.52,.48,.57,54)
peso_diamantes_winsorizado <- Winsorize(peso_diamante_con_error,0.10)
peso_diamantes_winsorizado
## [1] 0.4600 0.6100 0.5200 0.4800 0.5700 40.6525
peso_diamante_con_error <- c(.46,.61,.52,.48,.57,54)
peso_diamante_recortado <- Trim(peso_diamante_con_error,1)
peso_diamante_recortado
## [1] 0.61 0.52 0.48 0.57
## attr(,"trim")
## [1] 1 6