105 lines
3.1 KiB
R
105 lines
3.1 KiB
R
|
x <- c(862, 870, 876, 866, 871, 865, 861, 873, 871, 872)
|
|||
|
shapiro.test(x)$p.value
|
|||
|
qqnorm(x)
|
|||
|
qqline(x)
|
|||
|
mean(x)
|
|||
|
t.test(x, mu = 870, alternative = "less")$p.value
|
|||
|
x <- c(78.2, 78.5, 75.6, 78.5, 78.5, 77.4, 76.6)
|
|||
|
y <- c(76.1, 75.2, 75.8, 77.3, 77.3, 77.0, 74.4, 76.2, 73.5, 77.4)
|
|||
|
boxplot(x, y)
|
|||
|
shapiro.test(x)$p.value
|
|||
|
qqnorm(x)
|
|||
|
qqline(x)
|
|||
|
shapiro.test(y)$p.value
|
|||
|
qqnorm(y)
|
|||
|
qqline(y)
|
|||
|
var(x)
|
|||
|
var(y)
|
|||
|
var.test(x, y, alternative = "less")$p.value
|
|||
|
mean(x)
|
|||
|
mean(y)
|
|||
|
t.test(x, y, var.equal = TRUE, alternative = 'greater')$p.value
|
|||
|
x <- c(78.2, 78.5, 75.6, 78.5, 78.5, 77.4, 76.6)
|
|||
|
y <- c(76.1, 75.2, 75.8, 77.3, 77.3, 77.0, 74.4, 76.2, 73.5, 77.4)
|
|||
|
boxplot(x, y)
|
|||
|
mean(x)
|
|||
|
mean(y)
|
|||
|
t.test(x, y, var.equal = TRUE, alternative = 'greater')$p.value
|
|||
|
x <- c(88.2, 88.5, 85.6, 88.5, 88.5, 87.4, 86.6)
|
|||
|
y <- c(76.1, 75.2, 75.8, 77.3, 77.3, 77.0, 74.4, 76.2, 73.5, 77.4)
|
|||
|
boxplot(x, y)
|
|||
|
mean(x)
|
|||
|
mean(y)
|
|||
|
t.test(x, y, var.equal = TRUE, alternative = 'greater')$p.value
|
|||
|
shapiro.test(x)$p.value
|
|||
|
shapiro.test(y)$p.value
|
|||
|
var(x)
|
|||
|
var(y)
|
|||
|
var.test(x, y, alternative = "less")$p.value
|
|||
|
x <- c(78.2, 78.5, 75.6, 78.5, 78.5, 77.4, 76.6)
|
|||
|
y <- c(76.1, 75.2, 75.8, 77.3, 77.3, 77.0, 74.4, 76.2, 73.5, 77.4)
|
|||
|
t.test(x, y, var.equal = TRUE, alternative = 'greater')$p.value
|
|||
|
x <- c(78.2, 78.5, 75.6, 78.5, 78.5, 77.4, 76.6)
|
|||
|
y <- c(86.1, 85.2, 85.8, 87.3, 87.3, 87.0, 84.4, 86.2, 83.5, 87.4)
|
|||
|
t.test(x, y, var.equal = TRUE, alternative = 'greater')$p.value
|
|||
|
x <- c(78.2, 78.5, 75.6, 78.5, 78.5, 77.4, 76.6)
|
|||
|
y <- c(76.1, 75.2, 75.8, 77.3, 77.3, 77.0, 74.4, 76.2, 73.5, 77.4)
|
|||
|
t.test(x, y, var.equal = TRUE, alternative = 'greater')$p.value
|
|||
|
x <- c(84, 87, 87, 90, 90, 90, 90, 93, 93, 96)
|
|||
|
y <- c(89, 92, 98, 95, 95, 92, 95, 92, 98, 101)
|
|||
|
boxplot(x, y)
|
|||
|
shapiro.test(x)$p.value
|
|||
|
qqnorm(x)
|
|||
|
qqline(x)
|
|||
|
shapiro.test(y)$p.value
|
|||
|
qqnorm(y)
|
|||
|
qqline(y)
|
|||
|
mean(x)
|
|||
|
mean(y)
|
|||
|
t.test(x, y, paired = TRUE, alternative = 'less')$p.value
|
|||
|
x <- c(171, 176, 179, 189, 176, 182, 173, 179, 184, 186, 189, 167, 177)
|
|||
|
y <- c(161, 162, 163, 162, 166, 164, 168, 165, 168, 157, 161, 172)
|
|||
|
boxplot(x, y)
|
|||
|
shapiro.test(x)$p.value
|
|||
|
qqnorm(x)
|
|||
|
qqline(x)
|
|||
|
shapiro.test(y)$p.value
|
|||
|
qqnorm(y)
|
|||
|
qqline(y)
|
|||
|
var(x)
|
|||
|
var(y)
|
|||
|
var.test(x, y, alternative = "greater")$p.value
|
|||
|
mean(x)
|
|||
|
mean(y)
|
|||
|
t.test(x, y, alternative = 'greater')$p.value
|
|||
|
w_test <- function(x, lambda_zero, alternative = c('two.sided', 'less', 'greater')) {
|
|||
|
statistic <- 2 * length(x) * lambda_zero * mean(x)
|
|||
|
d <- 2 * length(x)
|
|||
|
alternative <- match.arg(alternative)
|
|||
|
p_value <- pchisq(statistic, d)
|
|||
|
p_value <- switch(alternative,
|
|||
|
'two.sided' = 2 * min(p_value, 1 - p_value),
|
|||
|
'greater' = p_value,
|
|||
|
'less' = 1 - p_value)
|
|||
|
names(statistic) <- 'T'
|
|||
|
names(d) <- 'num df'
|
|||
|
result <- list(statistic = statistic,
|
|||
|
parameter = d,
|
|||
|
p.value = p_value,
|
|||
|
alternative = alternative,
|
|||
|
method = 'Test chi-kwadrat w modelu wyk<79>adniczym',
|
|||
|
data.name = deparse(substitute(x)))
|
|||
|
class(result) <- 'htest'
|
|||
|
return(result)
|
|||
|
}
|
|||
|
awarie <- read.table("http://ls.home.amu.edu.pl/data_sets/awarie.txt")
|
|||
|
View(awarie)
|
|||
|
1 / mean(awarie$V1)
|
|||
|
w_test(awarie$V1, 0.001, 'less')
|
|||
|
x <- c(171, 176, 179, 189, 176, 182, 173, 179, 184, 186, 189, 167, 177)
|
|||
|
y <- c(161, 162, 163, 162, 166, 164, 168, 165, 168, 157, 161, 172)
|
|||
|
boxplot(x, y)
|
|||
|
shapiro.test(x)$p.value
|
|||
|
qqnorm(x)
|
|||
|
qqline(x)
|