1.不配对
# 创建两组模拟数据
group1 <- c(9.536312, 37.07379, 20.82934, 37.20035)
group2 <- c(3.185522, 57.45692, 10.12008, 57.29765)
# 进行独立样本t-test
result <- t.test(group1, group2)
# 打印t-test的结果
print(result)
2.配对
# 创建两组模拟数据
before <- c(9.536312, 37.07379, 20.82934, 37.20035)
after <- c(3.185522, 57.45692, 10.12008, 57.29765)
# 进行配对样本t-test
result <- t.test(before, after, paired=TRUE)
# 打印t-test的结果
print(result)
标签:创建,两组,group1,计算,Test,配对,模拟 From: https://www.cnblogs.com/wzbzk/p/17802250.html