This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/bash | |
#####################################################################text1 | |
## changePath | |
path="course_materials/tex" | |
filename="Dkiso1_book" | |
cd $path | |
## backup | |
cp ${filename}.tex ${filename}.old | |
########### upgrade patch | |
val=$(sed -n 4p ${filename}.tex ) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
library(rstan) | |
rstan_options(auto_write = TRUE) | |
options(mc.cores = parallel::detectCores()) | |
stancode <- " | |
data { | |
int<lower=0> J; // number of schools | |
real y[J]; // estimated treatment effects | |
real<lower=0> sigma[J]; // s.e. of effect estimates | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
A <- factor(rep(1:2,each=8),labels=LETTERS[1:2]) | |
B <- factor(rep(rep(1:4,each=2),2),labels=letters[1:4]) | |
C <- factor(rep(1:2,8),labels=c("あ","い")) | |
dat <- data.frame(A,B,C) | |
dat$val <- rnorm(16,0,1) | |
library(tidyverse) | |
dat %>% group_by(A,B) %>% summarise(means=mean(val)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
a <- 1.5 | |
d <- c(-1.5,0,1) | |
K <- 3 | |
pjkt <- function(theta,a,d,k,K){ | |
bunbo <- 0.0 | |
for(m in 0:K){ | |
tmp <- 0.0 | |
for(l in 0:m){ | |
if(l!=0){ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
model <- ' | |
parameters { | |
vector[2] z; | |
} | |
model{ | |
matrix[2,2] sigma; | |
vector[2] mu; | |
mu[1] <- 0.0; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
library(rstan) | |
rstan_options(auto_write = TRUE) | |
options(mc.cores = parallel::detectCores()) | |
model <- ' | |
data{ | |
int<lower=0> N1; | |
int<lower=0> N2; | |
int<lower=0> N3; | |
real y1[N1]; | |
real y2[N2]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
## 2016年度の不倫報道データ | |
dataset <- as.data.frame( | |
matrix(c("ベッキー","2016-01-07", | |
"狩野英孝","2016-02-03", | |
"宮崎謙介議員","2016-02-10", | |
"桂文枝","2016-03-16", | |
"石井竜也","2016-03-17", | |
"乙武洋匡","2016-03-23", | |
"とにかく明るい安村","2016-04-01", | |
"NMB48木下春奈","2016-05-08", |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
title: "心理学統計法レポート課題2016" | |
output: | |
bookdown::pdf_book: | |
toc: false | |
latex_engine: xelatex | |
mainfont: Hiragino Kaku Gothic Pro | |
--- | |
\begin{center} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
data{ | |
int N; | |
vector[N] X; | |
vector[N] Y; | |
} | |
parameters{ | |
real alpha; | |
real beta; | |
real<lower=0> sigma; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
data{ | |
int<lower=0> N1; | |
int<lower=0> N2; | |
real X1[N1]; | |
real X2[N2]; | |
} | |
parameters{ | |
real mu1; | |
real mu2; | |
real<lower=0> sigma1; |
NewerOlder