From 5b6ba6a28a538434daf048d3ff7a830b5fd5a5e8 Mon Sep 17 00:00:00 2001 From: davkoh Date: Tue, 29 Aug 2023 12:12:27 +0300 Subject: [PATCH] Fixes and reminders --- .DS_Store | Bin 0 -> 6148 bytes README.md | 2 +- demos_ch12/demo12_1.R | 2 +- demos_ch12/demo12_1.Rmd | 2 +- demos_ch5/demo5_2.R | 8 ++++---- demos_rstan/README.md | 2 ++ demos_rstan/rstanarm_demo.R | 4 ++-- demos_rstan/rstanarm_demo.Rmd | 4 ++-- 8 files changed, 13 insertions(+), 11 deletions(-) create mode 100644 .DS_Store diff --git a/.DS_Store b/.DS_Store new file mode 100644 index 0000000000000000000000000000000000000000..7da1da58ef199d7e3f76fae65f99cc71bddfbb74 GIT binary patch literal 6148 zcmeHK%}T>S5T0$TCWz33qQ?cV1%K)^D0ZwZeAWmC7T@XhtOu4;|(?|^(s-H%guJuj8aUHi=T^|k) z_6}=ucXw2i!{hyWO&%T8M2yisO=8Tcs!bUsK_LeFAhP#+yQ(C;I~D}*Fy(_Mm4 zTJ$Uy1~GynOevx%750iDOgZ|c&GRf422D8#y)r(>t}N^gMd;PhFLgQy&mfP?05dSj zK-o;I)c?=FzyD7b@r)T@2L2TTqH^Y+HE>I|w@z)2daXpgM% @@ -93,7 +93,7 @@ yl <- c(-5, 40) title2 <- TeX('Conditional means E\\[$\\theta_j | \\tau , y $\\]') plot_condmeans <- ggplot(data = df_condmeans) + geom_line(aes(x = x, y = p, color = (school=='A'), group = school)) + - coord_cartesian(ylim = yl, xlim = c(0, 35)) + + coord_cartesian(ylim = yl, xlim = c(0, 40)) + labs(x = expression(tau), y = TeX('E\\[$\\theta_j | \\tau , y $\\]'), title = title2, color = '') + scale_color_manual(values = c('blue','red'), labels = labs1) + theme(legend.background = element_blank(), legend.position = c(0.8,0.9)) @@ -107,7 +107,7 @@ yl <- c(0, 25) title3 <- TeX('Conditional standard deviations sd\\[$\\theta_j | \\tau , y $\\]') plot_condsds <- ggplot(data = df_condsds) + geom_line(aes(x = x, y = p, color = (school=='A'), group = school)) + - coord_cartesian(ylim = yl, xlim = c(0,35)) + + coord_cartesian(ylim = yl, xlim = c(0,40)) + labs(x = expression(tau), y = TeX('sd\\[$\\theta_j | \\tau , y $\\]'), title = title3, color = '') + scale_color_manual(values = c('blue','red'), labels = labs1) + theme(legend.background = element_blank(), legend.position = c(0.8,0.9)) diff --git a/demos_rstan/README.md b/demos_rstan/README.md index 22efce0..a4307f0 100644 --- a/demos_rstan/README.md +++ b/demos_rstan/README.md @@ -1,5 +1,7 @@ # Links to html versions of demos +If running the CMDStanR demos on Aalto Jupyter, please make sure to have specified the location for CMDStanR: set_cmdstan_path('/coursedata/cmdstan'). + - [rstan_demo: RStan demo](http://avehtari.github.io/BDA_R_demos/demos_rstan/rstan_demo.html) - [cmdstanr_demo: CmdStanR demo](http://avehtari.github.io/BDA_R_demos/demos_rstan/cmdstanr_demo.html) - [rstanarm_demo: RStanARM demo](http://avehtari.github.io/BDA_R_demos/demos_rstan/rstanarm_demo.html) diff --git a/demos_rstan/rstanarm_demo.R b/demos_rstan/rstanarm_demo.R index cc96292..8a393b7 100644 --- a/demos_rstan/rstanarm_demo.R +++ b/demos_rstan/rstanarm_demo.R @@ -194,7 +194,7 @@ mcmc_hist(draws_bin2, pars='oddsratio') #' # Linear Gaussian model #' #' The following file has Kilpisjärvi summer month temperatures 1952-2013: -data_kilpis <- read.delim('kilpisjarvi-summer-temp.csv', sep = ';') +data_kilpis <- read.delim('~/BDA_R_demos/demos_rstan/kilpisjarvi-summer-temp.csv', sep = ';') data_lin <-data.frame(year = data_kilpis$year, temp = data_kilpis[,5]) @@ -284,7 +284,7 @@ loo_compare(loo1, loo2) #' # Comparison of k groups with hierarchical models #' #' Let's compare the temperatures in three summer months. -data_kilpis <- read.delim('kilpisjarvi-summer-temp.csv', sep = ';') +data_kilpis <- read.delim('~/BDA_R_demos/demos_rstan/kilpisjarvi-summer-temp.csv', sep = ';') data_grp <- data.frame(month = rep(6:8, nrow(data_kilpis)), temp = c(t(data_kilpis[,2:4]))) diff --git a/demos_rstan/rstanarm_demo.Rmd b/demos_rstan/rstanarm_demo.Rmd index e090987..f54f173 100644 --- a/demos_rstan/rstanarm_demo.Rmd +++ b/demos_rstan/rstanarm_demo.Rmd @@ -239,7 +239,7 @@ mcmc_hist(draws_bin2, pars='oddsratio') The following file has Kilpisjärvi summer month temperatures 1952-2013: ```{r } -data_kilpis <- read.delim('kilpisjarvi-summer-temp.csv', sep = ';') +data_kilpis <- read.delim('~/BDA_R_demos/demos_rstan/kilpisjarvi-summer-temp.csv', sep = ';') data_lin <-data.frame(year = data_kilpis$year, temp = data_kilpis[,5]) ``` @@ -348,7 +348,7 @@ There is no practical difference between Gaussian and Student's t models. Let's compare the temperatures in three summer months. ```{r } -data_kilpis <- read.delim('kilpisjarvi-summer-temp.csv', sep = ';') +data_kilpis <- read.delim('~/BDA_R_demos/demos_rstan/kilpisjarvi-summer-temp.csv', sep = ';') data_grp <- data.frame(month = rep(6:8, nrow(data_kilpis)), temp = c(t(data_kilpis[,2:4]))) ```