{ #test=matrix(scan("hel34"),ncol=2,byrow=T) xx=scan("hel55") # Confidence interval on the population mean # assuming the data is Normally distributed print(c(t.test(x)$conf.int)) #or alpha=0.05 #confidence level alpha2=alpha/2 N=length(xx) #Lower limit XL = mean(xx) - qt(alpha2,N-1)*sd(xx)/sqrt(N) #Upper Limit UL = mean(xx) + qt(1-alpha2,N-1)*sd(xx)/sqrt(N) print(c(XL, UL)) ############# #confidence interval on the population variance #Lower Limit VL = var(xx)*(N-1)/qchisq(1-alpha2,N-1) #Upper Limit UL = var(xx)*(N-1)/qchisq(alpha2,N-1) print(c(XL, UL)) ########### #confidence interval on the median.. xx=sort(xx) xl=qbinom(0.025,length(x),0.5) xu=qbinom(0.0975,length(x),0.5) print(c(xx[xl],xx[xu])) }