normal_update.RdFinds the parameters of the normal posterior with normal data and a normal prior
normal_update(prior, data, teach=FALSE)
| prior | vector with components mean and sd of the normal prior |
|---|---|
| data | vector with components the sample mean and the standard error of the estimate |
| teach | logical variable indicating the form of the output |
If teach = TRUE, returns data frame that displays the mean, precision, and standard deviation for the prior, data, and posterior. If teach = FALSE, returns a vector with mean and standard deviation of the posterior.
prior <- c(100, 10) data <- c(110, 15) normal_update(prior, data)#> [1] 103.076923 8.320503normal_update(prior, data, teach=TRUE)#> Type Mean Precision Stand_Dev #> 1 Prior 100.0000 0.010000000 10.000000 #> 2 Data 110.0000 0.004444444 15.000000 #> 3 Posterior 103.0769 0.014444444 8.320503