forked from Penncil/Xmeta_online_platform
-
Notifications
You must be signed in to change notification settings - Fork 0
/
netmod.R
169 lines (123 loc) · 5.54 KB
/
netmod.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
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
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
netMod <- function(input, output, session){
data <- reactive({
validate(need(input$file, message = FALSE))
inFile <- input$file
df <- read.csv(inFile$datapath, header = input$header)
return(df)
})
output$contents <- renderText({
if (!is.na(data())){
"Your dataset has been successfully uploaded. Please choose the tabs on the left panel for further analysis"
}
})
output$mytable <- DT::renderDataTable({
dataset = data()
DT::datatable(dataset, options = list(orderClasses = TRUE))
})
output$summary <- renderPrint({
dataset = data()
mn1 <- netmeta(TE, seTE, treat1, treat2, studlab, data = dataset, sm = "MD")
print(mn1, digits = 2)
})
output$plot1 <- renderPlot({
dataset = data()
mn1 <- netmeta(TE, seTE, treat1, treat2, studlab, data = dataset, sm = "MD")
netgraph(mn1, seq = c("plac", "benf", "migl", "acar", "sulf",
"metf", "rosi", "piog", "sita", "vild"))
}, height=600)
output$plot2 <- renderPlot({
dataset = data()
mn1 <- netmeta(TE, seTE, treat1, treat2, studlab, data = dataset, sm = "MD")
netgraph(mn1, start="circle", iterate = TRUE,
col = "darkgray", cex = 1.5,
points =TRUE, col.points = "black", cex.points = 3,
col.multiarm = "gray", allfigures = TRUE)
}, height=600)
output$plot3 <- renderPlot({
dataset = data()
mn1 <- netmeta(TE, seTE, treat1, treat2, studlab, data = dataset, sm = "MD")
forest(mn1, xlim = c(-1.5, 1), ref ="plac",
leftlabs = "Contrast to Placebo",
xlab = "HbA1c difference")
}, height=600)
output$plot4 <- renderPlot({
dataset = data()
mn1 <- netmeta(TE, seTE, treat1, treat2, studlab, data = dataset, sm = "MD")
forest(mn1, xlim = c(-1.5, 1), ref = "plac",
leftlabs = "Contrast to Placebo",
xlab = "HbA1c difference",
pooled = "random")
}, height = 500)
output$summary2 <- renderPrint({
dataset = data()
mn1 <- netmeta(TE, seTE, treat1, treat2, studlab, data = dataset, sm = "MD")
round(decomp.design(mn1)$Q.decomp,3)
})
output$decomposition <- renderPrint({
dataset = data()
mn1 <- netmeta(TE, seTE, treat1, treat2, studlab, data = dataset, sm = "MD")
print(decomp.design(mn1)$Q.het.design, digits = 2)
})
output$summary3 <- renderPrint({
dataset = data()
mn1 <- netmeta(TE, seTE, treat1, treat2, studlab, data = dataset, sm = "MD")
round(decomp.design(mn1)$Q.inc.random, 3)
})
output$introduction <- renderText({
"The Net Heat Plot is a graphical presentation. It displays in a single plot with the following two types of information:
1. for each network estimate, the contribution of each design to this estimate
2. for each network estimate, the extent ofo inconsistency due to each design"
})
output$explanation <- renderText({
" 1. The grey squares have area propotional to the contribution from the treatment comparison in the column to the treatment comparison to the row.
2. The composition of heterogeneity are displayed in colour on the top-left to bottom-right, with the largest heterogeneity shown in red in the top left corner.
3. Red colour indicates that the evidence for the treatment comparison in the row from the design in the colomn is inconsistent; Conversely, blue indicates the evidence is consistent."
})
output$plot5 <- renderPlot({
dataset = data()
mn1 <- netmeta(TE, seTE, treat1, treat2, studlab, data = dataset, sm = "MD")
netheat(mn1)
}, height = 600)
output$plot6 <- renderPlot({
dataset = data()
mn1 <- netmeta(TE, seTE, treat1, treat2, studlab, data = dataset, sm = "MD")
netheat(mn1, random = TRUE)
}, height = 600)
}
###########################################################
###########################################################
###########################################################
netModUI <- function(id){
ns <- NS(id)
navlistPanel(
tabPanel("Upload File (network MA with continuous outcomes)",
sidebarLayout(
mainPanel(
fileInput(ns('file'), 'Choose CSV File',
accept=c('text/csv',
'text/comma-separated-values,text/plain',
'.csv')),
tags$br(),
checkboxInput(ns('header'), 'Header', TRUE)
),
mainPanel(
strong(tableOutput(ns('contents')))
)
)
),
tabPanel('Data', DT::dataTableOutput(ns('mytable'))),
'Estimate Overall Effect',
tabPanel('Summary', verbatimTextOutput(ns('summary'))),
tabPanel('Network Plot', plotOutput(ns('plot1'))),
tabPanel('Additinoal Network Plot', plotOutput(ns('plot2'))),
tabPanel('Forest Plot', plotOutput(ns('plot3')), plotOutput(ns('plot4'))),
'Heterogeneity Statistic',
tabPanel('Summary for Fixed Effect Model',verbatimTextOutput(ns('summary2'))),
tabPanel('Decomposition', verbatimTextOutput(ns('decomposition'))),
tabPanel('Summary for Random Effect Model', verbatimTextOutput(ns('summary3'))),
'The Net Heat Plot',
tabPanel('Introduction', verbatimTextOutput(ns('introduction'))),
tabPanel('Plot for Fixed Effect Model', verbatimTextOutput(ns('explanation')), plotOutput(ns('plot5'))),
tabPanel('Plot for Random Effect Model',plotOutput(ns('plot6')))
)
}