-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathmultivariate_regression.R
81 lines (56 loc) · 1.51 KB
/
multivariate_regression.R
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
xx <- c()
# Age, years
xx <- c(xx, 'age')
# Sex (baseline = female)
xx <- c(xx, 'gender')
# Ethnicity (baseline = white)
# Asian
# Black
# Chinese
# Mixed
# Others
xx <- c(xx, 'ethnicity_code')
xx <- c(xx, 'skin_colour')
xx <- c(xx, 'hair_colour')
xx <- c(xx, 'uv_protection')
xx <- c(xx, 'alcohol_intake')
# Month of birth
#t(t(table(d$f.52.0.0)))
#univariate('left_corneal_astigmatism','f.52.0.0',d)
# corneal corrected
# IOPg, mmHg
d$left_iop_cc <- d$f.5262.0.0
xx <- c(xx, 'left_iop_cc')
# Corrected Visual acuity, logMAR
d$left_logmar <- d$f.5208.0.0
xx <- c(xx, 'left_logmar')
# Corneal hysteresis
xx <- c(xx, 'corneal_hysterisis_left')
# Height, m
d$height <- d$f.50.0.0
xx <- c(xx, 'height')
# Weight, 10 kg
d$weight <- d$f.23098.0.0
xx <- c(xx,'weight')
# SBP, mmHg
d$SBP <- d$f.4080.0.0
xx <- c(xx,'SBP')
# DBP, mmHg
d$DBP <- d$f.4079.0.0
xx <- c(xx,'DBP')
xx <- unique(xx)
s <- summary(m <- lm(as.formula(paste('log(left_astigmatism) ~', paste(xx,collapse=' + '))),data=d))
print(s$coefficients)
confint(m)
s <- summary(m <- lm(as.formula(paste('log(left_astigmatism) ~ weight + height + gender')),data=d))
print(s$coefficients)
confint(m)
s <- summary(m <- lm(as.formula(paste('log(left_astigmatism) ~ weight + height')),data=d))
print(s$coefficients)
confint(m)
s <- summary(m <- lm(as.formula(paste('log(left_astigmatism) ~ gender + height')),data=d))
print(s$coefficients)
confint(m)
s <- summary(m <- lm(as.formula(paste('log(left_astigmatism) ~ gender + weight')),data=d))
print(s$coefficients)
confint(m)