Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- z <- (246.6-250)/9.8*sqrt(218)
- if (z < qnorm(0.01)){
- print("oszust na 99%")
- }
- qnorm(0.01)
- pnorm(z)
- #
- #ho:
- # mi = 5
- #h1:
- # mi != 5
- dane <- c(6.1753, 8.7678, 0.58231, 6.8243, 5.7375, 2.4846, 4.2328, 5.7852, 12.257, 10.639, 2.4002, 11.17, 6.5508, 4.9739, 6.5295, 4.6901, 4.8517, 8.0794, 7.9181, 7.9344)
- srednia = mean(dane)
- odch = sd(dane)
- z1 <- (srednia-5)/sd*sqrt(length(dane))
- if (z1 != qnorm(0.05/2)){
- print("oszust na 99%")
- }
- u = 5 (mi)
- u =! 5
- alfa = 0.05
- #H0: obszar kryt: (-inf, Z(alfa/2)) w sumie (Z(1-alfa/2), inf)
- data <- read.csv(#katalog strace naglowki, header = FALSE)
- dane <- c(6.1753, 8.7678, 0.58231, 6.8243, 5.7375, 2.4846, 4.2328, 5.7852, 12.257, 10.639, 2.4002, 11.17, 6.5508, 4.9739, 6.5295, 4.6901, 4.8517, 8.0794, 7.9181, 7.9344)
- #gdy by byl w .csv: to by byla tabela
- m <- mean(dane) #w csv: mean(dane$V1)
- s <- sd(dane) #w csv: sd(dane$V1)
- mu <- 5
- n <- length(dane) # length(dane&V1)
- Z <- sqrt(n)*(m-mu)/s #= 2.15
- qt(alfa/2, n-1) #= -2.09
- qt(1-alfa/2, n-1) #= 2.09
- #czyli obszar krytyczny: (-inf, -2.09) U (2.09, inf)
- #nasze Z jest w obszarze krytycznym, czyli odrzucamy naszą hipotezę
- # srednia nie wynosi 5
- t.test(dane, mu = 5)
- # 3
- n1 = 38
- n2 = 34
- mi1 = 42.6
- mi2 = 48.8
- s1 = 12.2
- s2 = 15.7
- alfa = 0.05
- znew = (mi1-mi2)/(sqrt(((s1^2)/n1)+((s2^2)/n2)))
- print(znew)
- qnorm(alfa)
- #odrzucam od (-inf, do qnorm(alfa))
- if (znew < qnorm(alfa)){
- print("akcja sie powiodla chyba")
- }
- #4
- dane <- read.csv("z4.txt", header = FALSE)
- alfa <- 0.05
- mi1 <- mean(dane$V1[dane$V2 ==1])
- mi2 <- mean(dane$V1[dane$V2 ==2])
- # powinno byc
- dane$V2 <- as.factor(dane&V2)
- t.test(V1~V2, data = dane)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement