--- title: 'Template shiny pour le TP3' author: "`M2 Statistique, 2017-2018`" date: "Statistique mathématique en grande dimension et applications" output: html_document runtime: shiny --- Voici une façon automatique de générer le plot d'un échantillon $X_1,\dots,X_n$ i.i.d. $\mathcal{N}(\theta,1)$. ```{r, echo=FALSE} inputPanel( selectInput("n", label = "Taille de l'échantillon:", choices = c(10 , 100, 1000), selected = 100), sliderInput("theta", label = "theta", min = -5, max = 5, value = 0, step = 1), actionButton("takeSample","Simuler") ) rv <- reactiveValues(sample = 0, n = 100 , theta = 0) observeEvent(input$takeSample, { rv$sample <-rnorm(as.numeric(input$n)) rv$n=as.numeric(input$n) rv$theta=as.numeric(input$theta) }) renderPlot({ n= rv$n theta= rv$theta xi=rv$sample if(input$takeSample){ Z=xi+theta plot(Z,cex.axis=2,xlab="",ylab="",ylim=c(-7,7),col=gray(0.4),pch=19) abline(h=theta,lwd=3,col="lightblue") title(paste("C'est joli est la moyenne empirique vaut",signif(mean(Z),2)),cex.main = 2,col.main= gray(0.2)) } },height = 600, width = 1000) ```