Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
Bootstrap for Gama Distribution
alfa = c() beta= c() set.seed(1839) for(i in 1:1000){ alfa[i] = sample(1:1000,1) beta[i]= sample(1:1000,1) } set.seed(717) pop = c() for(i in 1:1000){ pop[i]= rgamma(1,alfa[i],beta[i]) } amostra = sample(pop,200,replace=F) bot <- function(B,data,type = "media",quant = 0.95){ if(type=="media"){ r = B; dados = data; n= length(dados) vm = c() for(i in 1:r){ s = sample(dados,n,replace=T) vm[i]=mean(s) } return(vm) } if(type=="mediana"){ r = B; dados = data; n= length(dados) vm = c() for(i in 1:r){ s = sample(dados,n,replace=T) vm[i]=median(s) } return(vm) } if(type=="quantil"){ r = B; dados=data; n= length(dados);q = quant vq= c() for(i in 1:r){ s = sample (dados,n,replace=T) vq[i] = quantile(s,q) } return(vq) } } set.seed(1729) ream= bot(10000, amostra,"media") plot(5,5, ann = F, axes = T, type = "n",xlim=c(0,20),ylim=c(0,0.9)) lines(density (pop),col="red",lwd=1.5) lines(density (amostra),col="blue",lwd=1.5) lines(density (ream),col="darkgreen",lwd=1.5) points(mean(pop),0,col="red",pch=2,cex=0.3) points(mean(ream),0,col="darkgreen",pch=2,cex=0.3) med.pop= mean(pop) med.am= mean(amostra) med.ream= mean(ream) rbind(med.pop,med.am,med.ream) mpop = mean(pop) mam = mean(amostra) mream = mean(ream) rbind(mpop,mam,mream) q.pop = quantile (pop,0.95) q.am = quantile (amostra,0.95) q.ream = quantile(ream,0.95) rbind(q.pop,q.am,q.ream)
run
|
edit
|
history
|
help
0
direct_assignment
R1
ECO Stat
Gab1B
3.4.0 / 3.5.2 / 3.5.1 / 3.6.1 / 3.6.5.#
sinimona
waves 2
Binary search tree
First program
Linear regression Model [The spring constant]