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
| one_pie<-function(N,n){ | |
| coins<-rbinom(n,1,.5) | |
| means<- cumsum(coins)/(1:n) | |
| if (any(means>0.5)) return(means[min(which(means>0.5))]) | |
| coins2<-c(coins,rbinom(N,1,.5)) | |
| means2<-cumsum(coins2)/(1:(N+n)) | |
| if (any(means2>0.5)) return(means2[min(which(means2>0.5))]) | |
| return((1/2)+(1/(N+n+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
| Shows the power of the Rao-Scott (Wald) test in a 2-d problem. | |
| Alternative is parametrised by displacement (fixed to give specified power for intrinsic test) and by angle theta. | |
| Purple circle indicates power for intrinsic test (constant) | |
| black points are corresponding power for RS-type test. | |
| Maybe facet this to get a three-d problem? |
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
| stanfile<-write_stan_file( | |
| "data { | |
| int<lower=2> K; | |
| int<lower=0> N; | |
| int<lower=1> D; | |
| array[N] int<lower=1,upper=K> ybaseline; | |
| array[N] int<lower=ybaseline, upper=K> y; | |
| array[N] row_vector[D] x; |
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
| poll<-read.table("pollen.txt") | |
| pairs(poll, col="#00000010",pch=".") | |
| plot(poll[,1:2], col="#00000060",pch=".") |
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(survey) | |
| population<-data.frame(y=1:1000, | |
| strata=rep(1:3,c(100,200,700)), | |
| popsizes=rep(c(100,200,700),c(100,200,700)) | |
| ) | |
| with(population, by(y,strata,var)) | |
| sampsizes<-c("1"=10,"2"=30,"3"=50) |
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(shiny) | |
| # Define UI for application that draws a histogram | |
| ui <- fluidPage( | |
| # Application title | |
| titlePanel("Bayesian Surprise"), | |
| # Sidebar with a slider input for number of bins |
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
| abilities | |
| academics | |
| accessing | |
| accessory | |
| activated | |
| addiction | |
| additions | |
| admission | |
| advantage | |
| aerospace |
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
| paired_test<-function(formula, data, subset, paired=NULL, ...){ | |
| if (is.null(paired)) | |
| return("do the current thing") | |
| ## make sure paired is ~id | |
| if (!is.language(paired)) | |
| stop("paired must be a formula") | |
| if(!(length(paired)==2 && paired[[1L]]=="~" && length(paired[[2L]])<=2)) |
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
| ## New sample.int | |
| sample_int<-function(n, size=NULL, replace=FALSE, prob=NULL, | |
| useHash=(n > 1e+07 && !replace && is.null(prob) && (!is.null(size)) && size <= n/2), | |
| method=c("sequential","marginal","poisson")){ | |
| if (replace || is.null(prob)){ | |
| if (is.null(size)){ | |
| size<-n | |
| } | |
| } else{ |
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
| void tille_incprob(double a[], int *pn, int *plen){ | |
| double a_sum=0; | |
| int i,n,len,l,l1; | |
| n=*pn; | |
| len=*plen; | |
| for(i=0;i<len; i++){ | |
| a_sum+=a[i]; | |
| } |
NewerOlder