\[\mu = \frac{\sum X_N}{N}\]
- \(\mu\), or “mu,” represents the population mean or average
- \(\sum X_N\) represents the sum of the entire population.
- \(N\) represents size of the population.
2024-06-08
\[\mu = \frac{\sum X_N}{N}\]
\[\bar{x}= \frac{\sum x_n}{n}\]
Warning in geom_hline(yintercept = oh_mean$popblack, width = 2, color = "blue"): Ignoring unknown parameters: `width`
fig <- plot_ly(
data = oh_demo
,x = ~poptotal
,y = ~county
,type = 'bar'
,name = 'Total Population'
,orientation = 'h'
) %>%
add_trace(
x = ~popwhite
,name = 'White Population'
) %>%
add_trace(
x = ~popblack
,name = "Black Population"
) %>%
add_trace(
x = ~popallother
,name = 'Other Populations'
) %>%
layout(
title = 'Population by County with Mean Lines'
,xaxis = list(title = 'Count')
,yaxis = list(
title = 'County'
,categoryorder = 'total ascending'
)
,barmode = 'group'
,shapes = list(
list( # Total Population Line
type = 'line'
,y0 = 0
,y1 = 1
,yref = 'paper'
,x0 = oh_mean$poptotal
,x1 = oh_mean$poptotal
,line = list(
color = 'blue'
)
)
,list( # Total Population Line
type = 'line'
,y0 = 0
,y1 = 1
,yref = 'paper'
,x0 = oh_mean$popwhite
,x1 = oh_mean$popwhite
,line = list(
color = 'orange'
)
)
,list( # Total Population Line
type = 'line'
,y0 = 0
,y1 = 1
,yref = 'paper'
,x0 = oh_mean$popblack
,x1 = oh_mean$popblack
,line = list(
color = 'green'
)
)
,list( # Total Population Line
type = 'line'
,y0 = 0
,y1 = 1
,yref = 'paper'
,x0 = oh_mean$popallother
,x1 = oh_mean$popallother
,line = list(
color = 'red'
)
)
)
)