# uniform
x1 = runif(1000,min=0,max=1)
# norm
x2 = rnorm(1000,mean=0,sd=1)
# exponential
x3 = rexp(1000,rate=1)
# t
x4 = rt(1000,df=3)
# binom
x5 = rbinom(n=1000,size=3,prob=0.7)
# hist gram
hist(x1)
hist(x2)
hist(x3)
hist(x4)
hist(x5)
# vector params and non-iid(independent-identical-distribution)-samples obtained
# generates 100 samples from the contaminated normal distribution
# in which a sample is from N(0,1) with probability 0.95
# and otherwise from N(0,3)
contam = rnorm(100,0,(1+2*rbinom(100,1,0.05)))
hist(contam)
#sample
R语言_Simulation
最新推荐文章于 2024-04-04 08:00:00 发布