-1

私は光沢にかなり慣れていないので、質問がかなり単純であることは知っていますが、多くの調査を行ったにもかかわらず、比例テストの出力をレンダリングするために光沢を得ることができないようです. ユーザーがすべてのパラメーター (p1、p2、sig.level、power) を入力し、サンプル サイズ n が与えられるスクリプトを作成しようとしています。私はさまざまな方法を試しましたが、通常は出力がないか、「'n'、'p1'、'p2'、'power'、および 'sig.level' のいずれかが NULL でなければなりません」というエラーになります。 . どんな助けでも大歓迎です、ありがとう!

これまでの私のコード:

    ui<-shinyUI(fluidPage(
    headerPanel("Power Calculator"),
    fluidRow(
    column(12,
       wellPanel(
         helpText("This calculator can help you understand the power of 
                  your experimental design to detect treatment effects. You     
        can choose 
                  between a standard design in which individuals are randomly   
       assigned to treatment or control 
                  and a clustered design, in which groups of individuals are assigned to treatment 
                  and control together."),
         column(4,
                wellPanel(

         numericInput('p1a','prop1', value = 0.12, min = 0.01, max = 0.99),
         numericInput('p2a', 'prop2', value = 0.14, min = 0.01, max = 0.99),
         numericInput('sig.levela','significance level' , value = 0.95, min = 0.9, max = 0.99),
         numericInput('powera', 'power level', value = 0.8, min = 0.75, max = 0.99)
                ),
         column(8,
                wellPanel(
                  htmlOutput("nrequired")

                )
         )
         )
         )
         )
         )
         )
         )
         )

         server<-shinyServer(
        function(input, output) {



        sample.size<-reactive({
  p1<-input$p1a
  p2<-input$p2a
  sig.level<-input$sig.level$a
  power<-input$power.levela

})


output$nrequired <- renderPrint({
power.prop.test(sample.size)
print(sample.size)
})

}
)

shinyApp(ui=ui,server=server)
4

1 に答える 1

1

エラーメッセージは、リアクティブ式をパラメータとしてpower.prop.test渡すことによって発生します。sample.size

サーバー関数を次のように変更してみてください。

server <- shinyServer(function(input, output) {
  output$nrequired <- renderPrint({
    power.prop.test(p1 = input$p1a, p2 = input$p2a, 
                    sig.level = input$sig.levela, power = input$powera)
  })
})

ところで: 0.05 のデフォルト値を使用しているのに、sig.level0.95 のパラメーターを選択したことについて疑問に思っていました。power.prop.test

于 2016-06-17T05:53:27.763 に答える