Normal Parameters

Author

Russell Almond

Published

January 24, 2019

A parameter is a value that can be changed in a statistical model. For example, the mean and standard deviation are the parameters of the normal distribution, which is a model for a population. Changing the value of a parameter, changes the model. We can see that in the illustration below. Try changing the values of the mean and standard deviation and see what happens to the shape of the curve.

Inputs and Outputs

#| standalone: true
#| viewerHeight: 600
library(shiny)
ui <- fluidPage(
inputPanel(
  sliderInput("mn", label = "Mean Log:",
              min=-50, max=50, value=0, step=1),
  
  sliderInput("sd", label = "Standard Deviation Log:",
              min = 0.2, max = 10, value = 2, step = 0.1)
),
mainPanel(
  plotOutput("lognormcurve")))

server <- function (input,output) {
  output$lognormcurve <- renderPlot({
  mn <- as.numeric(input$mn)
  sd <- as.numeric(input$sd)
  xlim <- qlnorm(c(.001,.999),mn,sd)
  curve(dlnorm(x,mn,sd),xlim=xlim,
        main=paste("Lognormal distribution with mean log",mn,
                   "and log standard deviation",sd),
        xlab="X",ylab="Density",log="x")

})
}
shinyApp(ui=ui,server=server)