radiant-rstats / radiant

Business analytics using R and Shiny. The radiant app combines the menus from radiant.data, radiant.design, radiant.basics, radiant.model, and radiant.multivariate.
https://radiant-rstats.github.io/docs/
Other
459 stars 136 forks source link

Allowing for the selection of the prediction interval type #191

Closed NopeSiniscalco closed 1 year ago

NopeSiniscalco commented 1 year ago

Hi, In the linear regression prediction tab I added a drop-down to choose between the confidence and prediction intervals and thought it might be worth adding (My uni stats classmates would definitely appreciate it), though it might be too much clutter for the gui?

Here are the changes I implemented in radiant.model's regress_ui.R, though my implementation was solely for the purposes of my class and extremely basic :stuck_out_tongue:

First edit:

reg_predict_interval <- c(
  "Confidence" = "confidence",
  "Prediction" = "prediction"
)

Second edit:

## setting value for prediction interval type
  if (input$reg_predict_interval == "confidence") {
    reg_pred_args$interval <- "confidence"
  } else {
    reg_pred_args$interval <- "prediction"
  }
 reg_pred_args

Third edit:

selectInput(
          "reg_predict_interval",
          label = "Prediction interval type:", reg_predict_interval,
          selected = state_single("reg_predict_interval", reg_predict_interval, "confidence")
        ),
vnijs commented 1 year ago

Thanks for the suggestion. I'd rather not change the already pretty complex interface tbh. A relatively easy approach to address your preference would be to add the interval = "prediction" argument in code generated for Report > Rmd.

pred <- predict(result, pred_data = diamonds, interval = "prediction")