-
Notifications
You must be signed in to change notification settings - Fork 0
/
.Rhistory
129 lines (129 loc) · 4.67 KB
/
.Rhistory
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
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
# calculate QALY weights
library(dbplyr)
QALYweights <- function(qaly) {
# Thailand value set
lookup <- read.table("eq5dlookupthailand.txt",header=T)
lookup <- lookup %>% unite(combined,mobility,selfcare,activity,pain,anxiety,sep="",remove=TRUE)
qalyweights <- full_join(qaly,lookup,by="combined") %>% rename(thai_utility = EQ5Dindex)
# Indonesia value set
qalyweights<-qalyweights%>%
mutate(
indo_utility = 1,
indo_utility = ifelse(mobility == "1",indo_utility - 0,
ifelse(mobility =="2",indo_utility - 0.119,
ifelse(mobility =="3",indo_utility - 0.192,
ifelse(mobility =="4",indo_utility - 0.410,
ifelse(mobility =="5",indo_utility - 0.613,
9))))),
indo_utility = ifelse(selfcare == "1",indo_utility - 0,
ifelse(selfcare =="2",indo_utility - 0.101,
ifelse(selfcare =="3",indo_utility - 0.140,
ifelse(selfcare =="4",indo_utility - 0.248,
ifelse(selfcare =="5",indo_utility - 0.316,
9))))),
indo_utility = ifelse(activity == "1",indo_utility - 0,
ifelse(activity =="2",indo_utility - 0.090,
ifelse(activity =="3",indo_utility - 0.156,
ifelse(activity =="4",indo_utility - 0.301,
ifelse(activity =="5",indo_utility - 0.385,
9))))),
indo_utility = ifelse(pain == "1",indo_utility - 0,
ifelse(pain =="2",indo_utility - 0.086,
ifelse(pain =="3",indo_utility - 0.095,
ifelse(pain =="4",indo_utility - 0.198,
ifelse(pain =="5",indo_utility - 0.246,
9))))),
indo_utility = ifelse(anxiety == "1",indo_utility - 0,
ifelse(anxiety =="2",indo_utility - 0.079,
ifelse(anxiety =="3",indo_utility - 0.134,
ifelse(anxiety =="4",indo_utility - 0.227,
ifelse(anxiety =="5",indo_utility - 0.305,
9)))))#,
#indo_utility = ifelse(mobility>5 | selfcare>5| activity>5 | pain>5 | anxiety>5 ,9, indo_utility)
)
return(qalyweights)
}
tab <- read.table("eq5dlookupthailand.txt",header=T)
#
qalyweights<-tab%>%
mutate(
indo_utility = 1,
indo_utility = ifelse(mobility == "1",indo_utility - 0,
ifelse(mobility =="2",indo_utility - 0.119,
ifelse(mobility =="3",indo_utility - 0.192,
ifelse(mobility =="4",indo_utility - 0.410,
ifelse(mobility =="5",indo_utility - 0.613,
9))))),
indo_utility = ifelse(selfcare == "1",indo_utility - 0,
ifelse(selfcare =="2",indo_utility - 0.101,
ifelse(selfcare =="3",indo_utility - 0.140,
ifelse(selfcare =="4",indo_utility - 0.248,
ifelse(selfcare =="5",indo_utility - 0.316,
9))))),
indo_utility = ifelse(activity == "1",indo_utility - 0,
ifelse(activity =="2",indo_utility - 0.090,
ifelse(activity =="3",indo_utility - 0.156,
ifelse(activity =="4",indo_utility - 0.301,
ifelse(activity =="5",indo_utility - 0.385,
9))))),
indo_utility = ifelse(pain == "1",indo_utility - 0,
ifelse(pain =="2",indo_utility - 0.086,
ifelse(pain =="3",indo_utility - 0.095,
ifelse(pain =="4",indo_utility - 0.198,
ifelse(pain =="5",indo_utility - 0.246,
9))))),
indo_utility = ifelse(anxiety == "1",indo_utility - 0,
ifelse(anxiety =="2",indo_utility - 0.079,
ifelse(anxiety =="3",indo_utility - 0.134,
ifelse(anxiety =="4",indo_utility - 0.227,
ifelse(anxiety =="5",indo_utility - 0.305,
9))))),
indo_utility = ifelse(mobility>5 | selfcare>5| activity>5 | pain>5 | anxiety>5 ,9, indo_utility))
qalyweights <- qalyweights %>% rename(thai_utility=EQ5Dindex)
library(tidyverse)
install.packages("stringi")
library(tidyverse)
tab <- read.table("eq5dlookupthailand.txt",header=T)
#
qalyweights<-tab%>%
mutate(
indo_utility = 1,
indo_utility = ifelse(mobility == "1",indo_utility - 0,
ifelse(mobility =="2",indo_utility - 0.119,
ifelse(mobility =="3",indo_utility - 0.192,
ifelse(mobility =="4",indo_utility - 0.410,
ifelse(mobility =="5",indo_utility - 0.613,
9))))),
indo_utility = ifelse(selfcare == "1",indo_utility - 0,
ifelse(selfcare =="2",indo_utility - 0.101,
ifelse(selfcare =="3",indo_utility - 0.140,
ifelse(selfcare =="4",indo_utility - 0.248,
ifelse(selfcare =="5",indo_utility - 0.316,
9))))),
indo_utility = ifelse(activity == "1",indo_utility - 0,
ifelse(activity =="2",indo_utility - 0.090,
ifelse(activity =="3",indo_utility - 0.156,
ifelse(activity =="4",indo_utility - 0.301,
ifelse(activity =="5",indo_utility - 0.385,
9))))),
indo_utility = ifelse(pain == "1",indo_utility - 0,
ifelse(pain =="2",indo_utility - 0.086,
ifelse(pain =="3",indo_utility - 0.095,
ifelse(pain =="4",indo_utility - 0.198,
ifelse(pain =="5",indo_utility - 0.246,
9))))),
indo_utility = ifelse(anxiety == "1",indo_utility - 0,
ifelse(anxiety =="2",indo_utility - 0.079,
ifelse(anxiety =="3",indo_utility - 0.134,
ifelse(anxiety =="4",indo_utility - 0.227,
ifelse(anxiety =="5",indo_utility - 0.305,
9))))),
indo_utility = ifelse(mobility>5 | selfcare>5| activity>5 | pain>5 | anxiety>5 ,9, indo_utility))
qalyweights <- qalyweights %>% rename(thai_utility=EQ5Dindex)
write.csv(qalyweights,"table_allweights.csv")
View(qalyweights)
qw <- qalyweights
attach(qw)
str(qw)
hist(indo_utility)
hist(thai_utility)