1-sample proportions test without continuity correction
data: x out of n, null probability 0.5
X-squared = 1, df = 1, p-value = 0.3173
alternative hypothesis: true p is not equal to 0.5
95 percent confidence interval:
0.3561454 0.5475540
sample estimates:
p
0.45
Two Sample t-test
data: delta by group
t = -2.4388, df = 7, p-value = 0.04483
alternative hypothesis: true difference in means between group 介入群 and group 対照群 is not equal to 0
95 percent confidence interval:
-6.20413379 -0.09586621
sample estimates:
mean in group 介入群 mean in group 対照群
-3.40 -0.25
# t検定による群間比較t.test(bmi ~ gender, data = data, var.equal =TRUE)
Two Sample t-test
data: bmi by gender
t = 4.8528, df = 98, p-value = 4.594e-06
alternative hypothesis: true difference in means between group 男性 and group 女性 is not equal to 0
95 percent confidence interval:
1.049736 2.502264
sample estimates:
mean in group 男性 mean in group 女性
24.068 22.292
# 回帰分析(男性を基準)fit <-lm(bmi ~ gender, data = data)summary(fit)
Call:
lm(formula = bmi ~ gender, data = data)
Residuals:
Min 1Q Median 3Q Max
-4.892 -1.168 -0.130 1.332 4.232
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 24.0680 0.2588 93.005 < 2e-16 ***
gender女性 -1.7760 0.3660 -4.853 4.59e-06 ***
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Residual standard error: 1.83 on 98 degrees of freedom
Multiple R-squared: 0.1937, Adjusted R-squared: 0.1855
F-statistic: 23.55 on 1 and 98 DF, p-value: 4.594e-06
Two Sample t-test
data: 血圧変化量 by 群
t = -0.3356, df = 18, p-value = 0.7411
alternative hypothesis: true difference in means between group 試験群 and group 対照群 is not equal to 0
95 percent confidence interval:
-7.986197 5.786197
sample estimates:
mean in group 試験群 mean in group 対照群
-15.1 -14.0
summary(lm(`血圧変化量`~ 群, data = dat))
Call:
lm(formula = 血圧変化量 ~ 群, data = dat)
Residuals:
Min 1Q Median 3Q Max
-10.900 -4.000 -0.900 2.775 14.000
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) -15.100 2.318 -6.515 3.99e-06 ***
群対照群 1.100 3.278 0.336 0.741
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Residual standard error: 7.329 on 18 degrees of freedom
Multiple R-squared: 0.006218, Adjusted R-squared: -0.04899
F-statistic: 0.1126 on 1 and 18 DF, p-value: 0.7411
Call:
glm(formula = Y ~ X, family = binomial(), data = dat)
Coefficients:
Estimate Std. Error z value Pr(>|z|)
(Intercept) -1.7334 0.1534 -11.300 <2e-16 ***
X -0.1580 0.2375 -0.665 0.506
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
(Dispersion parameter for binomial family taken to be 1)
Null deviance: 489.57 on 599 degrees of freedom
Residual deviance: 489.13 on 598 degrees of freedom
AIC: 493.13
Number of Fisher Scoring iterations: 4
table(dat[dat$Z==0, "Y"], dat[dat$Z==0, "X"])
0 1
0 248 76
1 29 4
table(dat[dat$Z==1, "Y"], dat[dat$Z==1, "X"])
0 1
0 35 156
1 21 31
m_adj <-glm(Y ~ X + Z, data=dat, family=binomial())summary(m_adj)
Call:
glm(formula = Y ~ X + Z, family = binomial(), data = dat)
Coefficients:
Estimate Std. Error z value Pr(>|z|)
(Intercept) -2.1196 0.1862 -11.382 < 2e-16 ***
X -1.0250 0.2948 -3.477 0.000507 ***
Z 1.5554 0.2946 5.280 1.29e-07 ***
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
(Dispersion parameter for binomial family taken to be 1)
Null deviance: 489.57 on 599 degrees of freedom
Residual deviance: 459.79 on 597 degrees of freedom
AIC: 465.79
Number of Fisher Scoring iterations: 5
生存時間解析
例8.2:2 群の生存時間データ(253ページ)
library(survival)library(survminer)
Loading required package: ggplot2
Loading required package: ggpubr
Attaching package: 'survminer'
The following object is masked from 'package:survival':
myeloma