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
#標本平均,普遍分散のヒストグラム | |
setwd("~/Desktop") | |
Num.repeat <- 1.0 * 10^5 | |
List.flex <- c(2,3,4,5,6,7) | |
Tran <- "40" | |
List.color<- c("#0000ff","#3300cc","#660099","#990066","#cc0033","#ff0000") | |
Breaks <- 1000 | |
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
Sample <- c(4,3,4,7,7, | |
6,3,7,8,0, | |
1,7,8,6,7, | |
4,4,7,3,4) | |
n <- 8 | |
Step <- 0.001 | |
mcmcStep <- 20000 | |
mcmcTimes <- 20 | |
Z <- 1:mcmcStep |
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(shiny) | |
# Define server logic required to generate and plot a random distribution | |
shinyServer(function(input, output) { | |
output$distPlot <- renderPlot({ | |
N.sample <- input$obs | |
N.mean <- 5000 |
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(shiny) | |
# Define UI for application that plots random distributions | |
shinyUI(pageWithSidebar( | |
# Application title | |
headerPanel("Histgram of sample mean about dicerolling"), | |
# Sidebar with a slider input for number of observations | |
sidebarPanel( |
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> N; | |
real x[N]; | |
real f[N]; | |
int<lower=0,upper=100> y[N]; | |
} | |
parameters { | |
real b0; | |
real b1; | |
real b2; |
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) | |
library(coda) | |
setwd("~/R/stan_pois") | |
dat <- read.csv("data3a.csv",header = TRUE) | |
dat$f <- as.numeric(dat$f) -1 #カテゴリカルを01に変換 | |
listed.dat <- list(x = dat$x , y = dat$y, f = dat$f, N=100) | |
fit<-stan(file="model.stan",data=conflict.dat,iter=5000,chains=3) | |
traceplot(fit) |
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
# encoding: UTF-8 | |
require "fileutils" | |
###random sampling | |
class ProcessCSV | |
def initialize (orig) | |
#本当はコンストラクタで禁則文字,文字コードの設定もしたい. | |
@origFileName = orig | |
end |
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/ruby | |
#! ruby -EUTF-8 | |
# -*- mode:ruby; coding:utf-8 -*- | |
require 'MeCab' | |
require 'open-uri' | |
require 'nokogiri' | |
# スクレイピングするURL | |
url = [] | |
selector = [] |
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
#encoding : utf-8 | |
require 'twitter' | |
require 'pp' | |
client = Twitter::Streaming::Client.new do |config| | |
config.consumer_key = '0CmP0LrH7vkuRweDR0ySKg' | |
config.consumer_secret = 'fEeMhJQSZVMsVRQcYkx8SLgQmZ5a6V14Thm4IU3l8A' | |
config.access_token = '147866733-qq35ey3FpaYWEUOdXjoyoj1iA9BlmiHDKNwzMX9Y' | |
config.access_token_secret = '93R4bQAPvND9A0ZPfbcHIVHLc0AUZcvrmHZR7Al376NEb' |
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(ggplot2) | |
library(reshape2) | |
setwd("~/work/R/ggplot2") | |
T <- 300 | |
N <- 8 | |
bm <- rnorm(T*N) | |
bm <- matrix(bm,nrow = T, ncol= N) | |
bm <- apply(bm, 2, cumsum) |
OlderNewer