|
|
| server <- function(input, output, session) {
|
|
|
|
|
| {
|
| dataM <- reactive({
|
|
|
| if(input$dataInput==1){
|
|
|
| inFile <- input$archivo
|
|
|
| if(is.null(inFile)) {
|
|
|
| p <- sample(2:10,1)
|
| mu=c(rep(0,p) )
|
| sigma<-round(genPositiveDefMat("eigen",dim=p)$Sigma , 4)
|
| dt <- round(mvrnorm(n=100, mu,sigma),4)
|
| dt <- as.data.frame(dt)
|
| colnames(dt) <- paste("X",1:ncol(dt),sep = "")
|
| } else {
|
| dt <- read.csv(inFile$datapath,
|
| header=input$header,
|
| sep=input$sep,
|
| quote=input$quote)
|
|
|
| DT::datatable(dt)
|
| }
|
| return(dt)
|
|
|
| } else
|
|
|
| {
|
| inFile <- input$upload
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| if (is.null(input$upload)){
|
| return(NULL)
|
| }
|
| if (file.info(inFile$datapath)$size <= 20485800){
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| data <- rio::import(here::here(inFile$datapath))
|
|
|
| } else print("El Tamaño del Archivo es
|
| mayor a 10 MB y no se Puede
|
| Descargado.")
|
| }
|
|
|
| return(data)
|
|
|
| })
|
|
|
|
|
|
|
| variables <- reactive({
|
|
|
| return(input$variables)
|
| })
|
|
|
|
|
| rt <- reactive({
|
|
|
| tmp <- dataM() %>%
|
| dplyr::select(input$variables)
|
| return(tmp)
|
| })
|
|
|
| }
|
|
|
|
|
|
|
|
|
|
|
| {
|
|
|
|
|
|
|
| observe({
|
| data_tmp <- dataM()
|
| if(!is.null(data_tmp)){
|
| updateSelectizeInput(session = session,
|
| inputId = "variables",
|
| choices = colnames(data_tmp),
|
| selected = data_tmp)
|
| } else {
|
| updateSelectizeInput(session = session,
|
| inputId = "variables",
|
| choices = "",
|
| selected = "")
|
| }
|
| })
|
|
|
| }
|
|
|
|
|
|
|
|
|
|
|
|
|
| {
|
| output$tabla1 <- renderDataTable({
|
| if(input$tabs1 == "Datos"){
|
| DT::datatable(dataM(),
|
|
|
|
|
| options = list(
|
| pageLength = 5,
|
| lengthMenu = c(5,10,15,20,25,-1) )
|
| )
|
| }
|
| }
|
| )
|
|
|
| }
|
|
|
| {
|
| output$tabla2 <- renderDataTable({
|
|
|
| if(input$tabs1 == "Datos"){
|
| DT::datatable(rt(),
|
|
|
|
|
| options = list(
|
| pageLength = 5,
|
| lengthMenu = c(5,10,15,20,25,-1) )
|
| )
|
| }
|
| }
|
| )
|
|
|
| }
|
|
|
|
|
|
|
|
|
|
|
| {
|
| dataMa <- reactive({
|
|
|
| if(input$dataInputa==1){
|
|
|
| inFilea <- input$archivo
|
| if(is.null(inFilea)) {
|
|
|
| p <- sample(4:10,1)
|
| mu=c(rep(0,p) )
|
| sigma<-round(genPositiveDefMat("eigen",dim=p)$Sigma , 4)
|
| dta <- round(mvrnorm(n=100, mu,sigma),4)
|
| dta <- as.data.frame(dta)
|
| colnames(dta) <- paste("X",1:ncol(dta),sep = "")
|
| dta <- mutate(dta,
|
| Grupos=as.factor(c(rep(1,nrow(dta)/2),
|
| rep(2,nrow(dta)/2)) ) )
|
| } else {
|
| dta <- read.csv(inFilea$datapath,
|
| header=input$header,
|
| sep=input$sep,
|
| quote=input$quote)
|
|
|
| DT::datatable(dta)
|
| }
|
| return(dta)
|
|
|
| } else {
|
| inFilea <- input$uploada
|
| mySepa <- switch(input$fileSepDFa,
|
| '1'=",",
|
| '2'="\t",
|
| '3'=";",
|
| '4'=""
|
| )
|
| if (is.null(input$uploada)){
|
| return(NULL)
|
| }
|
| if (file.info(inFilea$datapath)$size <= 20485800){
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| dataa <- rio::import(here::here(inFilea$datapath))
|
|
|
| } else print("El Tamaño del Archivo es
|
| mayor a 10 MB y no se Puede
|
| Descargado.")
|
| }
|
| return(dataa)
|
| })
|
|
|
|
|
|
|
| variables1a <- reactive({
|
| return(input$variables1a)
|
| })
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| variables2a <- reactive({
|
| return(input$variables2a)
|
| })
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| rt2a <- reactive({
|
| tmp2a <- dataMa() %>% dplyr::filter(Grupos=="1") %>%
|
| dplyr::select(input$variables1a)
|
|
|
| return(tmp2a)
|
| })
|
|
|
|
|
| rt3a <- reactive({
|
| tmp3a <- dataMa() %>% dplyr::filter(Grupos=="2") %>%
|
| dplyr::select(input$variables2a)
|
|
|
| return(tmp3a)
|
| })
|
|
|
| }
|
|
|
|
|
|
|
|
|
|
|
| {
|
|
|
|
|
|
|
| observe({
|
| data_tmpa <- dataMa()
|
| if(!is.null(data_tmpa)){
|
| updateSelectInput(session = session,
|
| inputId = "variables1a",
|
| choices = colnames(data_tmpa),
|
| selected = data_tmpa)
|
| } else {
|
| updateSelectInput(session = session,
|
| inputId = "variables1a",
|
| choices = "",
|
| selected = "")
|
| }
|
| })
|
|
|
| observe({
|
| data_tmpa <- dataMa()
|
| if(!is.null(data_tmpa)){
|
| updateSelectInput(session = session,
|
| inputId = "variables2a",
|
| choices = colnames(data_tmpa),
|
| selected = data_tmpa)
|
| } else {
|
| updateSelectInput(session = session,
|
| inputId = "variables2a",
|
| choices = "",
|
| selected = "")
|
| }
|
| })
|
|
|
|
|
| }
|
|
|
|
|
| {
|
| observeEvent(input$sobre_datos_2Pob, {
|
| showModal(
|
| modalDialog("",
|
|
|
| tags$p("Para el caso de dos poblaciones se carga un
|
| solo archivo de datos, el cual debe traer
|
| una columna de nombre: ",
|
| tags$b( tags$em("Grupos,") ) ,
|
| "cuyos valores se etiquetan con los
|
| números 1 y 2." )
|
|
|
| )
|
| )
|
| }
|
| )
|
| }
|
|
|
|
|
| {
|
| observeEvent(input$sobre_datos_muestra, {
|
| showModal(
|
| modalDialog("",
|
|
|
| tags$p("Los ",
|
| tags$b( tags$em("Datos de Ejemplos,") ) ,
|
| "se refiere a un conjunto de datos normales
|
| p-variados (con p entre 2 y 10) que se generan
|
| cada vez que ejecutas la aplicación con los
|
| cuales puedes probar la App.
|
| Igualmente puedes cargar tus propios datos
|
| mediante la opción: Cargar Datos.
|
| " )
|
|
|
| )
|
| )
|
| }
|
| )
|
| }
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| {
|
| output$tabla1a <- renderDataTable({
|
| if(input$tabs2 == "Datos:"){
|
| DT::datatable(dataMa(),
|
|
|
|
|
| options = list(
|
| pageLength = 5,
|
| lengthMenu = c(5,10,15,20,25,-1) )
|
| )
|
| }
|
| }
|
| )
|
|
|
| }
|
|
|
|
|
| {
|
| output$tabla2a <- renderDataTable({
|
| if(input$tabs2 == "Datos:"){
|
| DT::datatable(rt2a(),
|
|
|
|
|
| options = list(
|
| pageLength = 5,
|
| lengthMenu = c(5,10,15,20,25,-1) )
|
| )
|
| }
|
| }
|
| )
|
|
|
| }
|
|
|
|
|
| {
|
| output$tabla3a <- renderDataTable({
|
| if(input$tabs2 == "Datos:"){
|
| DT::datatable(rt3a(),
|
|
|
|
|
| options = list(
|
| pageLength = 5,
|
| lengthMenu = c(5,10,15,20,25,-1) )
|
| )
|
| }
|
| }
|
| )
|
|
|
| }
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| prueba_nu <- reactive({
|
|
|
| dt <- rt()
|
|
|
| if(input$PH_NU_Seleccionada == 1){
|
|
|
| prueba <- mvn(dt,univariateTest=c("SW") )
|
|
|
| }
|
| else
|
| if(input$PH_NU_Seleccionada ==2){
|
|
|
| prueba <- mvn(dt,univariateTest=c("CVM") )
|
| }
|
| else
|
| if(input$PH_NU_Seleccionada ==3){
|
|
|
| prueba <- mvn(dt,univariateTest=c("Lillie") )
|
| }
|
| else
|
| if(input$PH_NU_Seleccionada ==4){
|
|
|
| prueba <- mvn(dt,univariateTest=c("SF") )
|
| }
|
| else
|
| if(input$PH_NU_Seleccionada ==5){
|
|
|
| prueba <- mvn(dt,univariateTest=c("AD") )
|
| }
|
|
|
| prueba$univariateNormality
|
|
|
| })
|
|
|
| output$Res_NU <- renderTable({
|
| prueba_nu()
|
| }, align='c', bordered = TRUE)
|
|
|
|
|
|
|
|
|
|
|
|
|
| output$resultados_PH_NU <- renderText({
|
|
|
| if(input$PH_NU_Seleccionada ==1){
|
| mensaje='- Los Resultados de la Prueba de Shapiro-Wilk son:'
|
| }
|
| else
|
| if(input$PH_NU_Seleccionada ==2){
|
| mensaje='- Los Resultados de la Prueba de
|
| Cramer-von Mises son:'
|
| }
|
| else
|
| if(input$PH_NU_Seleccionada ==3){
|
| mensaje='- Los Resultados de la Prueba de
|
| Lilliefors son:'
|
| }
|
| else
|
| if(input$PH_NU_Seleccionada ==4){
|
| mensaje='- Los Resultados de la Prueba de
|
| Shapiro-Francia son:'
|
| }
|
| else
|
| if(input$PH_NU_Seleccionada ==5){
|
| mensaje='- Los Resultados de la Prueba de
|
| Anderson-Darling son:'
|
| }
|
|
|
| mensaje
|
|
|
| })
|
|
|
|
|
|
|
|
|
|
|
| graficos_nu <- reactive({
|
|
|
| dt <- rt()
|
|
|
| if(input$Grafico_Seleccionado ==1){
|
|
|
| prueba <- mvn(dt,multivariatePlot=c("qq") )
|
|
|
| }
|
| else
|
| if(input$Grafico_Seleccionado ==2){
|
|
|
| prueba <- mvn(dt,univariatePlot=c("histogram") )
|
| }
|
| else
|
| if(input$Grafico_Seleccionado ==3){
|
|
|
| prueba <- mvn(dt,univariatePlot=c("box") )
|
| }
|
| else
|
| if(input$Grafico_Seleccionado ==4){
|
|
|
| prueba <- mvn(dt,univariatePlot=c("scatter") )
|
| }
|
|
|
| prueba$univariatePlot
|
|
|
| })
|
|
|
|
|
| output$Graf_NU <- renderPlot({
|
| graficos_nu()
|
| })
|
|
|
|
|
|
|
|
|
|
|
|
|
| output$resultados_PH_NM <- renderText({
|
|
|
| if(input$PH_NM_Seleccionada ==1){
|
| mensaje='- Los Resultados de la Prueba de Mardia son:'
|
| }
|
| else
|
| if(input$PH_NM_Seleccionada ==2){
|
| mensaje='- Los Resultados de la Prueba de
|
| Henze-Zirkler son:'
|
| }
|
| else
|
| if(input$PH_NM_Seleccionada ==3){
|
| mensaje='- Los Resultados de la Prueba de
|
| Royston son:'
|
| }
|
| else
|
| if(input$PH_NM_Seleccionada ==4){
|
| mensaje='- Los Resultados de la Prueba de
|
| Doornik-Hansen son:'
|
| }
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| mensaje
|
|
|
| })
|
|
|
|
|
|
|
|
|
| prueba_nm_mvn <- reactive({
|
|
|
| dt <- rt()
|
|
|
| if(input$PH_NM_Seleccionada == 1){
|
|
|
| prueba <- mvn(dt,mvnTest=c("mardia") )
|
|
|
| }
|
| else
|
| if(input$PH_NM_Seleccionada ==2){
|
|
|
| prueba <- mvn(dt,mvnTest=c("hz") )
|
| }
|
| else
|
| if(input$PH_NM_Seleccionada ==3){
|
|
|
| prueba <- mvn(dt,mvnTest=c("royston") )
|
| }
|
| else
|
| if(input$PH_NM_Seleccionada ==4){
|
|
|
| prueba <- mvn(dt,mvnTest=c("dh") )
|
| }
|
|
|
|
|
|
|
|
|
|
|
|
|
| prueba$multivariateNormality
|
|
|
| })
|
|
|
|
|
| output$Res_NM <- renderTable({
|
| prueba_nm_mvn()
|
| }, align='c', bordered = TRUE)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| graficos_nm <- reactive({
|
|
|
| dt <- rt()
|
|
|
|
|
|
|
| if(input$Grafico_Multi_Seleccionado ==1){
|
|
|
| prueba <- mvn(dt,multivariatePlot=c("qq"),
|
| multivariateOutlierMethod="quan",
|
| showOutliers=TRUE )
|
|
|
| }
|
| else
|
| if(input$Grafico_Multi_Seleccionado ==2){
|
|
|
| prueba <- mvn(dt,multivariatePlot=c("persp") )
|
|
|
|
|
| }
|
| else
|
| if(input$Grafico_Multi_Seleccionado ==3){
|
|
|
| prueba <- mvn(dt,multivariatePlot=c("contour") )
|
| }
|
|
|
| prueba$multivariatePlot
|
|
|
|
|
| })
|
|
|
|
|
| output$Graf_NM <- renderPlot({
|
| graficos_nm()
|
| })
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| output$PH_RD <- renderTable({
|
| dt <- rt()
|
| res<-mvn(dt,mvnTest=c("mardia") )
|
| res$Descriptive
|
| }, align='c', bordered = TRUE)
|
|
|
|
|
|
|
|
|
| output$Res_Descriptivos_Varios <- renderTable({
|
| dt <- rt()
|
| coef_asim <- apply(dt,2,asimetria)
|
| coef_kurt <- apply(dt,2,kurtosis)
|
| Res_Des <- data.frame(Asimetría=coef_asim,Kurtosis=coef_kurt)
|
| Res_Des
|
| })
|
|
|
|
|
|
|
|
|
|
|
|
|
| graficos_elipses <- reactive({
|
|
|
| dt <- rt()
|
|
|
| if(input$Graficos_Varios ==1){
|
|
|
| grafico <- representa(dt)
|
|
|
| }
|
| else
|
| if(input$Graficos_Varios ==2){
|
|
|
| grafico <- representa1c_np(dt,0.05)
|
|
|
| }
|
| else
|
| if(input$Graficos_Varios ==3){
|
|
|
| grafico <- representa1c_ng(dt,0.05)
|
| }
|
| else
|
| if(input$Graficos_Varios ==4){
|
|
|
| grafico <- representa2c_np(dt,0.01,0.05)
|
| }
|
| else
|
| if(input$Graficos_Varios ==5){
|
|
|
| grafico <- representa2c_ng(dt,0.01,0.05)
|
| }
|
| else
|
| if(input$Graficos_Varios ==6){
|
|
|
| grafico <- superficie_NB(apply(dt,2,mean),var( dt ) )
|
| }
|
| else
|
| if(input$Graficos_Varios ==7){
|
|
|
| grafico <- contorno_NB(apply(dt,2,mean),var( dt ) )
|
| }
|
| else
|
| if(input$Graficos_Varios ==8){
|
|
|
| grafico <- elipse_conf(dt,0.05,1000)
|
| }
|
| else
|
| if(input$Graficos_Varios ==9){
|
|
|
| grafico <- elipse_conf_IC_T2(dt,0.05,1000)
|
| }
|
| else
|
| if(input$Graficos_Varios ==10){
|
|
|
| grafico <- elipse_conf_IC_BONF(dt,0.05,1000)
|
| }
|
| else
|
| if(input$Graficos_Varios ==11){
|
|
|
| grafico <- elipse_conf_IC_tstud(dt,0.05,1000)
|
| }
|
|
|
| grafico
|
|
|
|
|
| })
|
|
|
|
|
| output$elipses <- renderPlot({
|
| graficos_elipses()
|
| })
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| output$PH_mu0 <- renderTable({
|
| mu_0 <- as.numeric(unlist(strsplit(input$mu0,",")))
|
| dt <- rt()
|
| res3 <- HT2_mu0(dt,mu_0,input$alfa)
|
| res3
|
| }, align='c', bordered = TRUE)
|
|
|
|
|
|
|
|
|
|
|
| output$conclus2 <- renderText({
|
| mu_0 <- as.numeric(unlist(strsplit(input$mu0,",")))
|
| dt <- rt()
|
| res5 <- HT2_mu0(dt,mu_0,input$alfa)
|
|
|
| ifelse(as.numeric(res5[7]) < input$alfa ,
|
| paste(strong('Como p = '), res5[7] , ' < ' ,
|
| input$alfa , withMathJax(' = \\( \\alpha \\); ') , strong('entonces,
|
| se rechaza H0') , sep="") ,
|
| paste('Como p = ' , res5[7] ,
|
| ' > ' , input$alfa , withMathJax(' = \\( \\alpha \\) ; '),
|
| strong('entonces, No se rechaza H0')
|
| ))
|
| })
|
|
|
|
|
|
|
|
|
|
|
| prueba_mu0r <- reactive({
|
|
|
| mu_0 <- as.numeric(unlist(strsplit(input$mu0,",")))
|
|
|
| dt <- rt()
|
|
|
| if(input$PruebaAnalitica == 1){
|
|
|
| prueba <- T2.test(dt, mu = mu_0 , conf.level = 1-input$alfa)
|
|
|
| }
|
| else
|
| if(input$PruebaAnalitica ==2){
|
|
|
| prueba <- HotellingsT2(dt,mu=mu_0,test="f")
|
|
|
| }
|
|
|
| prueba
|
|
|
| })
|
|
|
| output$Res_MU0r <- renderPrint({
|
| prueba_mu0r()
|
| })
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| output$PH_mu0_ng <- renderTable({
|
| mu_0 <- as.numeric(unlist(strsplit(input$mu0,",")))
|
| dt <- rt()
|
| res6 <- HT2_mu0_ngrande(dt,mu_0,input$alfa)
|
| res6
|
| }, align='c', bordered = TRUE)
|
|
|
|
|
|
|
|
|
|
|
|
|
| output$conclus2_mu0_ng <- renderText({
|
|
|
| mu_0 <- as.numeric(unlist(strsplit(input$mu0,",")))
|
|
|
| dt <- rt()
|
|
|
| res8 <- HT2_mu0_ngrande(dt,mu_0,input$alfa)
|
|
|
| ifelse(as.numeric(res8[4]) < input$alfa ,
|
| paste(strong('Como p = '), res8[4] , ' < ' ,
|
| input$alfa , withMathJax(' = \\( \\alpha \\) ; ') , strong('entonces,
|
| se rechaza H0') , sep="") ,
|
| paste('Como p = ' , res8[4] ,
|
| ' > ' , input$alfa , withMathJax(' = \\( \\alpha \\) ; '),
|
| strong('entonces,
|
| No se rechaza H0') ))
|
| })
|
|
|
|
|
|
|
|
|
|
|
|
|
| prueba_mu0r_ng <- reactive({
|
|
|
| mu_0 <- as.numeric(unlist(strsplit(input$mu0,",")))
|
|
|
| dt <- rt()
|
|
|
| if(input$PruebaAnalitica_ng ==1)
|
|
|
| prueba <- HotellingsT2(dt,mu=mu_0,test="chi")
|
|
|
| prueba
|
|
|
| })
|
|
|
| output$Res_MU0r_ng <- renderPrint({
|
| prueba_mu0r_ng()
|
| })
|
|
|
|
|
|
|
|
|
|
|
| output$mat_var_cov <- renderTable({
|
| dt <- rt()
|
| s <- var(rt())
|
|
|
| round(s,4)
|
| })
|
|
|
| output$mat_var_cov_sigma0 <- renderTable({
|
| dt <- rt()
|
| sigma00 <- as.numeric(unlist(strsplit(input$sigma0,",")))
|
|
|
| sigma_0 <- matrix(c(sigma00), nrow=ncol(rt()),
|
| ncol=ncol(rt()),byrow=TRUE)
|
|
|
| sigma_0
|
| })
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| output$PH_Sigma0 <- renderTable({
|
| dt <- rt()
|
|
|
|
|
| sigma00 <- as.numeric(unlist(strsplit(input$sigma0,",")))
|
|
|
| sigma_0 <- matrix(c(sigma00), nrow=ncol(rt()),
|
| ncol=ncol(rt()),byrow=TRUE)
|
|
|
| res <- sigma_sigma0_npqna(dt,sigma_0,input$alfa_sigma)
|
| res
|
| }, align='c', bordered = TRUE)
|
|
|
|
|
|
|
|
|
|
|
|
|
| output$conclus_sigma0 <- renderText({
|
| dt <- rt()
|
|
|
|
|
| sigma00 <- as.numeric(unlist(strsplit(input$sigma0,",")))
|
|
|
| sigma_0 <- matrix(c(sigma00), nrow=ncol(rt()),
|
| ncol=ncol(rt()),byrow=TRUE)
|
|
|
| res <- sigma_sigma0_npqna(dt,sigma_0,input$alfa_sigma)
|
| res
|
|
|
| ifelse(as.numeric(res[5]) < input$alfa_sigma ,
|
| paste(strong('Como p = '), res[5] , ' < ' ,
|
| input$alfa_sigma , withMathJax(' = \\( \\alpha \\); ') , strong('entonces,
|
| se rechaza H0') , sep="") ,
|
| paste('Como p = ' , res[5] ,
|
| ' > ' , input$alfa_sigma , withMathJax(' = \\( \\alpha \\) ; '),
|
| strong('entonces, No se rechaza H0')
|
| ))
|
| })
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| output$PH_Sigma0_ng <- renderTable({
|
| dt <- rt()
|
|
|
|
|
| sigma00 <- as.numeric(unlist(strsplit(input$sigma0,",")))
|
|
|
| sigma_0 <- matrix(c(sigma00), nrow=ncol(rt()),
|
| ncol=ncol(rt()),byrow=TRUE)
|
|
|
| res <- sigma_sigma0_ngrande(dt,sigma_0,input$alfa_sigma)
|
| res
|
| }, align='c', bordered = TRUE)
|
|
|
|
|
|
|
|
|
|
|
|
|
| output$conclus_sigma0_ng <- renderText({
|
| dt <- rt()
|
|
|
|
|
| sigma00 <- as.numeric(unlist(strsplit(input$sigma0,",")))
|
|
|
| sigma_0 <- matrix(c(sigma00), nrow=ncol(rt()),
|
| ncol=ncol(rt()),byrow=TRUE)
|
|
|
| res <- sigma_sigma0_ngrande(dt,sigma_0,input$alfa_sigma)
|
| res
|
|
|
| ifelse(as.numeric(res[4]) < input$alfa_sigma ,
|
| paste(strong('Como p = '), res[4] , ' < ' ,
|
| input$alfa_sigma , withMathJax(' = \\( \\alpha \\); ') , strong('entonces,
|
| se rechaza H0') , sep="") ,
|
| paste('Como p = ' , res[4] ,
|
| ' > ' , input$alfa_sigma , withMathJax(' = \\( \\alpha \\) ; '),
|
| strong('entonces, No se rechaza H0')
|
| ))
|
| })
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| prueba_sigma0_r <- reactive({
|
| dt <- rt()
|
|
|
| S <- matrix(var(dt),ncol=ncol(rt()) )
|
|
|
| n <- nrow(dt)
|
|
|
| sigma00 <- as.numeric(unlist(strsplit(input$sigma0,",")))
|
|
|
| sigma_0 <- matrix(c(sigma00), nrow=ncol(rt()),
|
| ncol=ncol(rt()),byrow=TRUE)
|
|
|
| if(input$Prueba_sigma == 1){
|
|
|
| prueba <- one_covar_matrix_test(sigma_0, S, n, method = "lrt")
|
|
|
| }
|
| else
|
| if(input$Prueba_sigma ==2){
|
|
|
| prueba <- one_covar_matrix_test(sigma_0, S, n, method='modlrt1')
|
|
|
| }
|
| else
|
| if(input$Prueba_sigma ==3){
|
|
|
| prueba <- one_covar_matrix_test(sigma_0, S, n, method='modlrt2')
|
|
|
| }
|
|
|
|
|
| prueba
|
|
|
| })
|
|
|
| output$Res_sigma0r <- renderPrint({
|
| prueba_sigma0_r()
|
| })
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| output$PH_mu1_mu2_FU <- renderTable({
|
| mu_0 <- as.numeric(unlist(strsplit(input$mu0a,",")))
|
| dt1 <- rt2a()
|
| dt2 <- rt3a()
|
| res3 <- HT2_sigmas_iguales(dt1,dt2,mu_0,input$alfaa)
|
| res3
|
| }, align='c', bordered = TRUE)
|
|
|
|
|
|
|
|
|
|
|
| output$conclus2a <- renderText({
|
| mu_0 <- as.numeric(unlist(strsplit(input$mu0a,",")))
|
| dt1 <- rt2a()
|
| dt2 <- rt3a()
|
| res5 <- HT2_sigmas_iguales(dt1,dt2,mu_0,input$alfaa)
|
| ifelse(as.numeric(res5[7]) < input$alfaa ,
|
| paste(strong('Como p = '), res5[7] , ' < ' ,
|
| input$alfaa , withMathJax(' = \\( \\alpha \\); ') , strong('entonces,
|
| se rechaza H0') , sep="") ,
|
| paste('Como p = ' , res5[7] ,
|
| ' > ' , input$alfaa , withMathJax(' = \\( \\alpha \\) ; '),
|
| strong('entonces, No se rechaza H0')
|
| ))
|
| })
|
|
|
|
|
|
|
|
|
|
|
| output$PH_mu1_mu2_FU_sigmas_dif <- renderTable({
|
| mu_0 <- as.numeric(unlist(strsplit(input$mu0a,",")))
|
| dt1 <- rt2a()
|
| dt2 <- rt3a()
|
| res3 <- HT2_sigmas_diferentes(dt1,dt2,mu_0,input$alfaa)
|
| res3
|
| }, align='c', bordered = TRUE)
|
|
|
|
|
|
|
|
|
|
|
| output$conclus4a <- renderText({
|
| mu_0 <- as.numeric(unlist(strsplit(input$mu0a,",")))
|
| dt1 <- rt2a()
|
| dt2 <- rt3a()
|
| res5 <- HT2_sigmas_diferentes(dt1,dt2,mu_0,input$alfaa)
|
| ifelse(as.numeric(res5[8]) < input$alfaa ,
|
| paste(strong('Como p = '), res5[8] , ' < ' ,
|
| input$alfaa , withMathJax(' = \\( \\alpha \\); ') , strong('entonces,
|
| se rechaza H0') , sep="") ,
|
| paste('Como p = ' , res5[8] ,
|
| ' > ' , input$alfaa , withMathJax(' = \\( \\alpha \\) ; '),
|
| strong('entonces, No se rechaza H0')
|
| ))
|
| })
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| prueba_mu0r2 <- reactive({
|
|
|
| mu_0 <- as.numeric(unlist(strsplit(input$mu0a,",")))
|
|
|
| dt1 <- rt2a()
|
| dt2 <- rt3a()
|
|
|
| if(input$PruebaAnaliticaa == 1){
|
|
|
| prueba <- T2.test(dt1, dt2, mu = mu_0 , conf.level = 1-input$alfaa)
|
|
|
| }
|
| else
|
| if(input$PruebaAnaliticaa ==2){
|
|
|
| prueba <- HotellingsT2(dt1,dt2,mu=mu_0,test="f")
|
|
|
| }
|
|
|
| prueba
|
|
|
| })
|
|
|
| output$Res_mu1_mu2_R <- renderPrint({
|
| prueba_mu0r2()
|
| })
|
|
|
|
|
|
|
|
|
|
|
| output$PH_mu1_mu2_FU_NG <- renderTable({
|
| mu_0 <- as.numeric(unlist(strsplit(input$mu0a,",")))
|
| dt1 <- rt2a()
|
| dt2 <- rt3a()
|
| res3 <- HT2_sigmas_iguales_ngrande(dt1,dt2,mu_0,input$alfaa)
|
| res3
|
| }, align='c', bordered = TRUE)
|
|
|
|
|
|
|
|
|
|
|
| output$conclus3a <- renderText({
|
| mu_0 <- as.numeric(unlist(strsplit(input$mu0a,",")))
|
| dt1 <- rt2a()
|
| dt2 <- rt3a()
|
| res5 <- HT2_sigmas_iguales_ngrande(dt1,dt2,mu_0,input$alfaa)
|
| ifelse(as.numeric(res5[4]) < input$alfaa ,
|
| paste(strong('Como p = '), res5[4] , ' < ' ,
|
| input$alfaa , withMathJax(' = \\( \\alpha \\); ') , strong('entonces,
|
| se rechaza H0') , sep="") ,
|
| paste('Como p = ' , res5[4] ,
|
| ' > ' , input$alfaa , withMathJax(' = \\( \\alpha \\) ; '),
|
| strong('entonces, No se rechaza H0')
|
| ))
|
| })
|
|
|
|
|
|
|
|
|
|
|
|
|
| prueba_mu0r_ng2 <- reactive({
|
|
|
| mu_0 <- as.numeric(unlist(strsplit(input$mu0a,",")))
|
|
|
| dt1 <- rt2a()
|
| dt2 <- rt3a()
|
|
|
| if(input$PruebaAnalitica_nga == 1){
|
|
|
| prueba <- HotellingsT2(dt1, dt2, mu = mu_0
|
| ,test="chi")
|
|
|
| }
|
| else
|
| if(input$PruebaAnaliticaa ==2){
|
|
|
| prueba <- HotellingsT2(dt1,dt2,mu=mu_0,test="chi")
|
|
|
| }
|
|
|
| prueba
|
|
|
| })
|
|
|
| output$Res_mu1_mu2_R_NG <- renderPrint({
|
| prueba_mu0r_ng2()
|
| })
|
|
|
|
|
|
|
|
|
|
|
| output$PH_mu1_mu2_FU_MPareadas <- renderTable({
|
| dt1 <- rt2a()
|
| dt2 <- rt3a()
|
| res <- HT2_pareadas(dt1,dt2,input$alfa1a)
|
| res
|
| }, align='c', bordered = TRUE)
|
|
|
|
|
|
|
|
|
|
|
| output$conclus6a <- renderText({
|
| dt1 <- rt2a()
|
| dt2 <- rt3a()
|
| res5 <- HT2_pareadas(dt1,dt2,input$alfa1a)
|
|
|
| ifelse(as.numeric(res5[7]) < input$alfa1a ,
|
| paste(strong('Como p = '), res5[7] , ' < ' ,
|
| input$alfa1a , withMathJax(' = \\( \\alpha \\); ') , strong('entonces,
|
| se rechaza H0') , sep="") ,
|
| paste('Como p = ' , res5[7] ,
|
| ' > ' , input$alfa1a , withMathJax(' = \\( \\alpha \\) ; '),
|
| strong('entonces, No se rechaza H0')
|
| ))
|
| })
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| prueba_mu0r92 <- reactive({
|
| dt1 <- rt2a()
|
| dt2 <- rt3a()
|
|
|
| dt <- as.data.frame(rbind(dt1,dt2) )
|
|
|
| Grupos <- as.factor(
|
| c( rep(1,nrow(dt1)) , rep(2,nrow(dt2) ) ) )
|
|
|
|
|
|
|
| if(input$Prueba_mp == 1){
|
|
|
| prueba <- ergm::approx.hotelling.diff.test(dt1,dt2,
|
| assume.indep = FALSE,
|
| var.equal = FALSE)
|
|
|
| }
|
| else
|
| if(input$Prueba_mp == 2){
|
|
|
| prueba <- ergm::approx.hotelling.diff.test(dt1,dt2,
|
| assume.indep = FALSE,
|
| var.equal = FALSE)
|
|
|
| }
|
|
|
| prueba
|
|
|
| })
|
|
|
| output$Res_mu1_mu2_R_MPareadas <- renderPrint({
|
| prueba_mu0r92()
|
| })
|
|
|
|
|
|
|
|
|
|
|
| output$PH_sigma1_sigma2_FU <- renderTable({
|
|
|
| dt1 <- rt2a()
|
| dt2 <- rt3a()
|
| res <- prueba_M_Box2(dt1,dt2,input$alfa2a)
|
| res
|
| }, align='c', bordered = TRUE)
|
|
|
|
|
|
|
|
|
|
|
| output$conclus8a <- renderText({
|
| dt1 <- rt2a()
|
| dt2 <- rt3a()
|
| res5 <- prueba_M_Box2(dt1,dt2,input$alfa2a)
|
| ifelse(as.numeric(res5[6]) < input$alfa2a ,
|
| paste(strong('Como p = '), res5[6] , ' < ' ,
|
| input$alfa2a , withMathJax(' = \\( \\alpha \\); ') , strong('entonces,
|
| se rechaza H0') , sep="") ,
|
| paste('Como p = ' , res5[6] ,
|
| ' > ' , input$alfa2a , withMathJax(' = \\( \\alpha \\) ; '),
|
| strong('entonces, No se rechaza H0')
|
| ))
|
| })
|
|
|
|
|
|
|
|
|
|
|
| prueba_mu0r82 <- reactive({
|
| dt1 <- rt2a()
|
| dt2 <- rt3a()
|
|
|
| dt <- as.data.frame(rbind(dt1,dt2) )
|
|
|
| Grupos <- as.factor(
|
| c( rep(1,nrow(dt1)) , rep(2,nrow(dt2) ) ) )
|
|
|
|
|
|
|
| if(input$Prueba_box == 1){
|
|
|
| prueba <- biotools::boxM(dt,Grupos)
|
|
|
| }
|
| else
|
| if(input$Prueba_box == 2){
|
|
|
| prueba <- biotools::boxM(dt,Grupos)
|
|
|
| }
|
|
|
| prueba
|
|
|
| })
|
|
|
| output$Res_sigma1_sigma2_R <- renderPrint({
|
| prueba_mu0r82()
|
| })
|
|
|
|
|
|
|
|
|
|
|
| }
|
|
|
|
|
|
|
|
|