2018-07-01から1ヶ月間の記事一覧

RStan でカテゴリカル変数の単回帰

係数の和=0の制約をいれる場合。 ##Fit with categorical variable 2 x0<-sample(1:4,100,replace=T) library(dummies) x<-dummy(x0) x1<-x[,1] x2<-x[,2] x3<-x[,3] x4<-x[,4] a1<-2 a2<--2 a3<-10 a4<--10 y<-a1*x1+a2*x2+a3*x3+a4*x4+rnorm(100,sd=0.03…

ruby でJIS第2水準までかの判定

R

ruby で文字列がJIS第2水準までかの判定 #-*= coding: utf-8 -*- def check_jis_dai2made_only? str begin puts "start" str_euc=str.encode("EUC-JP","UTF-8") rescue => eq puts eq return false end str_euc.split("").each{|s| #s2=s.unpack("H*")[0].t…

Rmarkdown で日本語PDF

R

Rmarkdown で日本語PDF。 かなりはまる。 Windows7 https://qiita.com/Atsushi776/items/9ef1e5d744e2b91c61ee(1)Texlive をインストール →インストーラは途中失敗するので、isoイメージからダウンロードして使うのがよい(.iso) (2)RStudio のインストール (…