This file contains hidden or 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(ggplot2) | |
library(purrr) | |
library(dplyr) | |
library(lawstat) | |
# Normal distribution | |
test_norm <- function(R = 2000, N = c(30, 30), | |
mu = c(0, 0), sigma = c(1, 1)) { | |
y <- purrr::map(seq_len(R), function(i) { | |
x1 <- rnorm(N[1], mean = mu[1], sd = sigma[1]) |
This file contains hidden or 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: "Stein estimator" | |
author: "ITÔ, Hiroki" | |
date: "2018/3/22" | |
output: html_document | |
--- | |
```{r setup, include=FALSE} | |
knitr::opts_chunk$set(echo = TRUE) | |
``` |
This file contains hidden or 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/env ruby -Ku | |
#%%%{CotEditorXInput=AllText}%%% | |
#%%%{CotEditorXOutput=ReplaceAllText}%%% | |
require 'cgi' | |
while $stdin.gets | |
print CGI.escapeHTML($_) | |
end |
This file contains hidden or 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(Rcpp) | |
library(inline) | |
## C++ source | |
mandelbrot.src <- " | |
Rcpp::NumericVector x(xx); | |
Rcpp::NumericVector y(yy); | |
unsigned short t = Rcpp::as<unsigned short>(threshold); | |
int nx = x.size(), ny = y.size(); | |
Rcpp::NumericVector u(nx); |
This file contains hidden or 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(ggplot2) | |
# http://www.cookbook-r.com/Graphs/Colors_(ggplot2)/ | |
# The palette with grey: | |
cbPalette <- c("#999999", "#E69F00", "#56B4E9", "#009E73", | |
"#F0E442", "#0072B2", "#D55E00", "#CC79A7") | |
data(iris) | |
p <- ggplot(iris) + | |
geom_histogram(aes(Sepal.Length, fill = Species), |
This file contains hidden or 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> N_ind; | |
int<lower = 0> N_t; | |
int<lower = 0, upper = 2> Y[N_ind, N_t]; // 0: missing value | |
} | |
parameters { | |
real<lower = 0, upper = 1> phi; | |
real<lower = 0, upper = 1> psi; | |
real<lower = 0, upper = 1> p; |
This file contains hidden or 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(purrr) | |
sim_inc_sample <- function(N_start = 20, N_end = 100, | |
mu = 0, sigma = 1, sig = 0.05) { | |
not_sig <- TRUE | |
N <- N_start | |
x1 <- rnorm(N_end, mu, sigma) | |
x2 <- rnorm(N_end, mu, sigma) | |
while(not_sig & N <= N_end) { | |
p_value <- t.test(x1[1:N], x2[1:N])$p.value |
This file contains hidden or 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
## ANOVA and Kruskal-Wallis test for data with unequal variances | |
library(ggplot2) | |
library(purrr) | |
library(dplyr) | |
# Normal distribution | |
test_norm <- function(R = 2000, N = c(30, 30, 30), | |
mu = c(0, 0, 0), sigma = c(1, 1, 1)) { | |
y <- purrr::map(seq_len(R), function(i) { |
This file contains hidden or 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
# 経県値マップ*1をプロットするRスクリプト | |
# *1 https://uub.jp/j.cgi/ | |
library(NipponMap) | |
library(stringr) | |
col_map <- c("white", "cyan", "yellowgreen", "yellow", "red", "purple") | |
# MAPの値は、都道府県コードの順にスコアを並べたものになります。 |
This file contains hidden or 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
# see https://qiita.com/th1nkd0g/items/3182e210b6a8b0ba0e79 | |
env PYTHON_CONFIGURE_OPTS="--enable-framework CC=clang" pyenv install 3.6.5 | |
pyenv global 3.6.5 | |
sudo ln -s /usr/local/var/pyenv/versions/3.6.5/Python.framework/Versions/3.6 /Library/Frameworks/Python.framework/Versions/ |
OlderNewer