-
Notifications
You must be signed in to change notification settings - Fork 206
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fixes and reminders #6
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -20,7 +20,7 @@ library(gridExtra) | |
library(tidyr) | ||
library(latex2exp) | ||
library(rprojroot) | ||
root<-has_file(".BDA_R_demos_root")$make_fix_file() | ||
root<-has_file(".BDA_R_demos_root")$make_fix_file() # Make sure to set parent directory to ~/notebooks/BDA_R_demos | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. we should make this automatic |
||
|
||
#' Data | ||
y <- c(28,8,-3,7,-1,1,18,12) | ||
|
@@ -81,7 +81,7 @@ plot_margpost <- | |
geom_line(aes(x = x, y = p), color='forestgreen') + | ||
labs(x = expression(tau), y = TeX('$p(\\tau | y)$'), title = title1) + | ||
scale_y_continuous(breaks = 0) + | ||
xlim(c(0, 35)) | ||
xlim(c(0, 40)) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. why was this change needed? |
||
|
||
|
||
df_condmeans <- as.data.frame(t(tm)) %>% | ||
|
@@ -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)) | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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'). | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This should work automatically as soon as IT has fixed it |
||
|
||
- [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) | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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 = ';') | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. No fixed absolute paths! |
||
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 = ';') | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. No fixed absolute paths! |
||
data_grp <- data.frame(month = rep(6:8, nrow(data_kilpis)), | ||
temp = c(t(data_kilpis[,2:4]))) | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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 = ';') | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. No fixed absolute paths! |
||
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 = ';') | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. No fixed absolute paths! |
||
data_grp <- data.frame(month = rep(6:8, nrow(data_kilpis)), | ||
temp = c(t(data_kilpis[,2:4]))) | ||
``` | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should make this automatic