Skip to content

Commit

Permalink
Changes to show plots
Browse files Browse the repository at this point in the history
  • Loading branch information
alexsanchezpla committed Nov 11, 2024
1 parent d43e152 commit d041e5f
Show file tree
Hide file tree
Showing 13 changed files with 89 additions and 67 deletions.
8 changes: 6 additions & 2 deletions 05-grandesMuestras.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ Ahora, supongamos que lanzamos el dado repetidamente y calculamos la media de lo

Podemos ilustrarlo con el siguiente código de R

```{r, fig.path="docs/imagenes/"}
```{r}
# Definir la función para simular lanzamientos de un dado
simular_dado <- function(max_n) {
medias <- numeric(max_n) # Vector para almacenar las medias muestrales
Expand All @@ -53,13 +53,17 @@ max_n <- 10000
medias <- simular_dado(max_n)
# Graficar las medias muestrales a medida que n aumenta
png("images/LLN1.png")
plot(1:max_n, medias, type = "l", col = "blue", lwd = 2,
xlab = "Número de lanzamientos (n)", ylab = "Media muestral",
main = "Ley de los Grandes Números\n Media de los lanzamientos de un dado", cex.main=0.7)
abline(h = 3.5, col = "red", lwd = 2, lty = 2) # Línea horizontal en 3.5
dev.off()
```

```{r, LLN1, out.width="90%", fig.align='center'}
knitr::include_graphics("images/LLN1.png",rel_path = TRUE)
```


Este comportamiento es una manifestación intuitiva de la ley débil de los grandes números, ya que nos garantiza que la media muestral se acercará a la media poblacional a medida que el número de observaciones aumente.
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Binary file not shown.
Binary file modified docs/FundamentosInferenciaEstadistica.pdf
Binary file not shown.
15 changes: 14 additions & 1 deletion docs/FundamentosInferenciaEstadistica.tex
Original file line number Diff line number Diff line change
Expand Up @@ -4792,14 +4792,27 @@ \subsubsection{Ejemplo}\label{ejemplo-3}
\NormalTok{medias }\OtherTok{\textless{}{-}} \FunctionTok{simular\_dado}\NormalTok{(max\_n)}
\CommentTok{\# Graficar las medias muestrales a medida que n aumenta}
\FunctionTok{png}\NormalTok{(}\StringTok{"images/LLN1.png"}\NormalTok{)}
\FunctionTok{plot}\NormalTok{(}\DecValTok{1}\SpecialCharTok{:}\NormalTok{max\_n, medias, }\AttributeTok{type =} \StringTok{"l"}\NormalTok{, }\AttributeTok{col =} \StringTok{"blue"}\NormalTok{, }\AttributeTok{lwd =} \DecValTok{2}\NormalTok{,}
\AttributeTok{xlab =} \StringTok{"Número de lanzamientos (n)"}\NormalTok{, }\AttributeTok{ylab =} \StringTok{"Media muestral"}\NormalTok{,}
\AttributeTok{main =} \StringTok{"Ley de los Grandes Números}\SpecialCharTok{\textbackslash{}n}\StringTok{ Media de los lanzamientos de un dado"}\NormalTok{, }\AttributeTok{cex.main=}\FloatTok{0.7}\NormalTok{)}
\FunctionTok{abline}\NormalTok{(}\AttributeTok{h =} \FloatTok{3.5}\NormalTok{, }\AttributeTok{col =} \StringTok{"red"}\NormalTok{, }\AttributeTok{lwd =} \DecValTok{2}\NormalTok{, }\AttributeTok{lty =} \DecValTok{2}\NormalTok{) }\CommentTok{\# Línea horizontal en 3.5}
\FunctionTok{dev.off}\NormalTok{()}
\end{Highlighting}
\end{Shaded}
\begin{verbatim}
## pdf
## 2
\end{verbatim}
\begin{Shaded}
\begin{Highlighting}[]
\NormalTok{knitr}\SpecialCharTok{::}\FunctionTok{include\_graphics}\NormalTok{(}\StringTok{"images/LLN1.png"}\NormalTok{,}\AttributeTok{rel\_path =} \ConstantTok{TRUE}\NormalTok{)}
\end{Highlighting}
\end{Shaded}
\includegraphics{docs/imagenes/unnamed-chunk-13-1.pdf}
\begin{center}\includegraphics[width=0.9\linewidth]{images/LLN1} \end{center}
Este comportamiento es una manifestación intuitiva de la ley débil de los grandes números, ya que nos garantiza que la media muestral se acercará a la media poblacional a medida que el número de observaciones aumente.
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
131 changes: 68 additions & 63 deletions docs/grandes-muestras.html

Large diffs are not rendered by default.

Binary file added docs/images/LLN1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion docs/search_index.json

Large diffs are not rendered by default.

Binary file added images/LLN1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit d041e5f

Please sign in to comment.