set.seed(402)
m <- 100 # Number of samples
n <- 500 # Sample size
a <- array(0,m)
ll <- array(0,m)
ul <- array(0,m)
i <- 0
while (i < m)
{ i <- i + 1
a[i] <- mean(rnorm(n))
ll[i] <- a[i] + qnorm(0.025)*sqrt(1/n)
ul[i] <- a[i] + qnorm(0.975)*sqrt(1/n)
}
interval.plot(ll,ul)
Results
R version 3.3.1 (2016-06-21) -- "Bug in Your Hair"
Copyright (C) 2016 The R Foundation for Statistical Computing
Platform: x86_64-pc-linux-gnu (64-bit)
R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.
R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.
Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.
> library(PASWR)
Loading required package: e1071
Loading required package: MASS
Loading required package: lattice
> png(filename="/home/ddbj/snapshot/RGM3/R_CC/result/PASWR/interval.plot.Rd_%03d_medium.png", width=480, height=480)
> ### Name: interval.plot
> ### Title: Interval Plot
> ### Aliases: interval.plot
> ### Keywords: misc
>
> ### ** Examples
>
> set.seed(402)
> m <- 100 # Number of samples
> n <- 500 # Sample size
> a <- array(0,m)
> ll <- array(0,m)
> ul <- array(0,m)
> i <- 0
> while (i < m)
+ { i <- i + 1
+ a[i] <- mean(rnorm(n))
+ ll[i] <- a[i] + qnorm(0.025)*sqrt(1/n)
+ ul[i] <- a[i] + qnorm(0.975)*sqrt(1/n)
+ }
> interval.plot(ll,ul)
$`Number of intervals that contain 0`
[1] 95
>
>
>
>
>
> dev.off()
null device
1
>