Articles

Affichage des articles du mars, 2019

Bug in shiny::updateCheckboxGroupInput()

If you want unselected all checkboxes defined using  updateCheckboxGroupInput , the syntax should be: updateCheckboxGroupInput(session, inputId, selected = NULL) However, it does not work. You must indicate again the parameter choices explicitly Look at this code: rm(list = ls()) library(shiny) runApp(list(   ui = basicPage(     checkboxGroupInput('chkGrp',                         label="Choix",                         choices=list("A"="a", "B"="b", "C"="c", "D"="d", "E"="e")),     actionButton("all","All"),     actionButton("noneWithChoices","None With Choices"),     actionButton("noneWithoutChoices","None Without Choices"),     actionButton("partial","Partial"),     verbatimTextOutput("value")   ),   server = function(input, output, session) {     output$

Example of using bootstraps to estimate SE of a mean

Image
Just a little game to know better bootstraps. Note that when the number of observations is low, the estimator is biased. See here for a solution: Bondy, Warren; Zlot, William (1976). "The Standard Error of the Mean and the Difference Between Means for Finite Populations". The American Statistician. 30 (2): 96–97. finalerr <- NULL reptest <- c(10000, 50000, 100000) ltest <- c(10, 20, 30, 50, 100, 200, 300, 400, 500) for (rep in reptest) {   perror <- NULL   for (l in ltest) {          taille <- runif(n=l, min=160, max=180)          # The standard error of the series     # sd(taille)/sqrt(l)               m <- rep(NA, rep)     for (i in 1:rep) m[i] <- mean(taille[sample(x=1:l, size = l, replace = TRUE)])          # The standard deviation of the means obtained using bootstrap     # sd(m)          perror <- c(perror, 100*(sd(m)-(sd(taille)/sqrt(l)))/(sd(taille)/sqrt(l)))   }   finalerr <- cbind(finalerr, perror)    } plot

Install XML packages in MacOSX

In terminal, enter brew install libxml2 Then enter these 3 lines: export PKG_CONFIG_PATH="/usr/local/opt/libxml2/lib/pkgconfig" export CPPFLAGS="-I/usr/local/opt/libxml2/include" export LDFLAGS="-L/usr/local/opt/libxml2/lib" You can put these lines in your .profile Then  R install.packages("XML")