a <- c(4,1,0,1,4,8) # Numer albumu: 410148
t <- round(mean(a))
b <- a + 1:6
g <- round((prod(b))^(1/6))
t; g## [1] 3
## [1] 6
N <- 10 * g
x <- rbinom(N, size = 5, prob = 1/t)
T <- table(x)
# Wykres słupkowy
barplot(T, col = rainbow(length(T)), main = "TWykres słupkowy", sub = "Rys. 1.a")# Wykres kołowy
pie(T, col = rainbow(length(T)), main = "Wykres kołowy", sub = "Rys. 1.b")x <- runif(2, min = 1, max = 3)
m <- 10 * x[1]
s <- x[2]
Dane <- rnorm(500, mean = m, sd = s)
# Statystyki
summary(Dane)## Min. 1st Qu. Median Mean 3rd Qu. Max.
## 17.92 25.04 26.99 26.93 29.12 35.00
# Histogram
hist(Dane, col = "limegreen", main = "Histogram", sub = "Rys. 2.b")# Wykres pudełkowy
boxplot(Dane, col = "lightcyan" , main = "Wykres pudełkowy", sub = "Rys. 2.c")x <- c(3.1, 12.9, 8.6, 6.5, 8.1, 7.5, 9.8, 10.9, 14.7, 10.5, 9.9, 8.9, 10.1, 10.2, 6.4)
y <- rnorm(100, mean = 10, sd = 3)
# Test Kołmogorowa-Smirnowa
ks.test(x, y)##
## Two-sample Kolmogorov-Smirnov test
##
## data: x and y
## D = 0.23667, p-value = 0.3968
## alternative hypothesis: two-sided
# Wykres pudełkowy dla x i y
L <- list(x = x, y = y)
boxplot(L, varwidth = TRUE, sub = "Rys. 3.b", col = c("skyblue", "orange"))# Test t-Studenta i przedział ufności
wynik_ttest <- t.test(x, mu = 10, conf.level = 0.95)
wynik_ttest##
## One Sample t-test
##
## data: x
## t = -1.1059, df = 14, p-value = 0.2874
## alternative hypothesis: true mean is not equal to 10
## 95 percent confidence interval:
## 7.668067 10.745267
## sample estimates:
## mean of x
## 9.206667
# Histogram z gęstościami
hist(x, prob = TRUE, xlim = c(1,16), main = "Histogram z gęstościami", sub = "Rys. 3.d")
lines(density(x), col = "green")
lines(0:16, dnorm(0:16, mean = 10, sd = 3), col = "red")
legend("topright", legend = c("Empiryczna", "Teoretyczna"), col = c("green", "red"), lwd = 2)Dokument opracowany przez Laurę Jurgałę w ramach Projektu 1 - czerwiec 2025.