Open Finterly opened 1 month ago
Thanks for your careful read, Finterly :)
The "missing" normalization is actually part of Exercise 2, although I appreciate that it is confusing not to have it part of Exercise 1 code. My apologies for the confusion, and thanks for letting me know.
Dear Dr. Cohen,
I was working on your exercises and noticed a possible typo in the code for Exercise #1 in stats_ch04_descriptives.R
When creating figure B code staring here: https://github.com/mikexcohen/Statistics_book/blob/b442b2159002c51befa7863e4f4e90155f4819d4/R/stats_ch04_descriptives.R#L1109
The family of gaussians are not normalized so you get this
instead of
This can be possibly fixed by adding the following in the bold after line 1114: https://github.com/mikexcohen/Statistics_book/blob/b442b2159002c51befa7863e4f4e90155f4819d4/R/stats_ch04_descriptives.R#L1114
for (i in 1:N) { a <- 1 / (sigmas[i] sqrt(2 pi)) # Normalization factor eTerm <- -x ^ 2 / (2 sigmas[i] ^ 2) G <- rbind(G, a exp(eTerm)) # Include scaling factor }