daily pastebin goal
6%
SHARE
TWEET

Untitled

a guest Mar 24th, 2019 55 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. varS <- function(x,nj, myMean) {
  2.   for(i in 1:length(x)) {
  3.     x[i] <- ((x[i] - myMean)^2)*nj[i]
  4.   }
  5.   s <- sum(x)/(sum(nj)-1)
  6. }
  7. true_value_sig <- function(n, alpha=0.05, s) {
  8.   a <- (n-1)*s^2/ qchisq(1-alpha/2, n-1)
  9.   b <- (n-1)*s^2/ qchisq(alpha/2, n-1)
  10.   c(a,b)
  11. }
  12.  
  13. srednia<- 1/180*(0.2*25+ 0.6*50+1*40 + 1.4*35+ 1.8*30)
  14. x <- c(0.2, 0.6, 1, 1.4, 1.8)
  15. nj <- c(25,50,40,35,30)
  16. myS <- sqrt(varS(x,nj, srednia))
  17. (true_value_m(180,alpha=0.1,srednia,s=myS))
  18. # Ans.: 0.9245566 1.0532212
  19. (sqrt(true_value_sig(180, alpha=0.1, s=myS)))
  20. # Ans.: (0.4805589, 0.5720536)
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top