-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathmodule_five.R
171 lines (122 loc) · 5.56 KB
/
module_five.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
# Including the core functionality
source("module_five_core.R")
## ======================= UTILITY LIST ==========================
module_five_list<-c( "Continous Uniform",
"Continous Normal",
#"Bivariate Normal",
"Gamma Distribution",
"Exponential distribution"
)
## ========================= I/O FUNCTIONS ==============================
## =========================== uniform continous distribution ======================================
my_cont_uniform_input<-function(){
tagList(
textInput('my_cont_uniform_input_dataOne', 'alpha', "0.1"),
textInput('my_cont_uniform_input_dataTwo', 'Beta', "0.9"),
textInput('my_cont_uniform_input_dataThree', 'lower limit for Integration', "0"),
textInput('my_cont_uniform_input_dataFour', 'upper limit for Integration', "1")
)
}
my_cont_uniform_output<-function(){
tagList(
renderPrint({
# Preparing data
alpha <- as.numeric(unlist(strsplit(input$my_cont_uniform_input_dataOne,",")))
beta <- as.numeric(unlist(strsplit(input$my_cont_uniform_input_dataTwo,",")))
lower <- as.numeric(unlist(strsplit(input$my_cont_uniform_input_dataThree,",")))
upper <- as.numeric(unlist(strsplit(input$my_cont_uniform_input_dataFour,",")))
# ---------------- Display data set as well smoothly ---------------------- #
# Nicely Display the source data
cat(sprintf("Continuous Uniform Distribution :\n\n"))
cat(sprintf("\nalpha : %s",alpha))
cat(sprintf("\nbeta : %s",beta))
cat(sprintf("\nlower limit : %s",lower))
cat(sprintf("\nupper limit : %s",upper))
result<-my_cont_uniform(alpha,beta,lower,upper)
cat(sprintf("\n\nResult : \n%s",result))
})
)
}
## =========================== Normal continous distribution ======================================
my_cont_normal_input<-function(){
tagList(
textInput('my_cont_normal_input_dataOne', 'Mean', "2"),
textInput('my_cont_normal_input_dataTwo', 'Population SD', "1"),
textInput('my_cont_normal_input_dataThree', 'lower limit for Integration', "0"),
textInput('my_cont_normal_input_dataFour', 'upper limit for Integration', "1")
)
}
my_cont_normal_output<-function(){
tagList(
renderPrint({
# Preparing data
mean <- as.numeric(unlist(strsplit(input$my_cont_normal_input_dataOne,",")))
pSD <- as.numeric(unlist(strsplit(input$my_cont_normal_input_dataTwo,",")))
lower <- as.numeric(unlist(strsplit(input$my_cont_normal_input_dataThree,",")))
upper <- as.numeric(unlist(strsplit(input$my_cont_normal_input_dataFour,",")))
# ---------------- Display data set as well smoothly ---------------------- #
# Nicely Display the source data
cat(sprintf("Continuous Normal Distribution :\n\n"))
cat(sprintf("\nMean : %s",mean))
cat(sprintf("\nPopulation SD : %s",pSD))
cat(sprintf("\nlower limit : %s",lower))
cat(sprintf("\nupper limit : %s",upper))
result<-my_cont_normal(mean,pSD,lower,upper)
cat(sprintf("\n\nResult : \n%s",result))
})
)
}
## ========================== gamma and exponential function ======================================
my_gamma_test_input<-function(){
tagList(
textInput('my_gamma_test_input_dataOne', 'alpha', "0.9"),
textInput('my_gamma_test_input_dataTwo', 'Beta', "9"),
textInput('my_gamma_test_input_dataThree', 'lower limit for Integration', "0"),
textInput('my_gamma_test_input_dataFour', 'upper limit for Integration', "1")
)
}
my_gamma_test_output<-function(){
tagList(
renderPrint({
# Preparing data
alpha <- as.numeric(unlist(strsplit(input$my_gamma_test_input_dataOne,",")))
beta <- as.numeric(unlist(strsplit(input$my_gamma_test_input_dataTwo,",")))
lower <- as.numeric(unlist(strsplit(input$my_gamma_test_input_dataThree,",")))
upper <- as.numeric(unlist(strsplit(input$my_gamma_test_input_dataFour,",")))
# ---------------- Display data set as well smoothly ---------------------- #
# Nicely Display the source data
cat(sprintf("Gamma Distribution :\n\n"))
cat(sprintf("\nalpha : %s",alpha))
cat(sprintf("\nbeta : %s",beta))
cat(sprintf("\nlower limit : %s",lower))
cat(sprintf("\nupper limit : %s",upper))
result<-my_gamma_test(alpha,beta,lower,upper)
cat(sprintf("\n\nResult : \n%s",result))
})
)
}
my_exp_dist_input<-function(){
tagList(
textInput('my_exp_dist_input_dataOne', 'lambda', "0.4"),
textInput('my_exp_dist_input_dataTwo', 'lower limit for Integration', "1"),
textInput('my_exp_dist_input_dataThree', 'upper limit for Integration', "2")
)
}
my_exp_dist_output<-function(){
tagList(
renderPrint({
# Preparing data
mylambda <- as.numeric(unlist(strsplit(input$my_exp_dist_input_dataOne,",")))
lower <- as.numeric(unlist(strsplit(input$my_exp_dist_input_dataTwo,",")))
upper <- as.numeric(unlist(strsplit(input$my_exp_dist_input_dataThree,",")))
# ---------------- Display data set as well smoothly ---------------------- #
# Nicely Display the source data
cat(sprintf("Exponential Distribution :\n\n"))
cat(sprintf("\nlambda : %s",mylambda))
cat(sprintf("\nlower limit : %s",lower))
cat(sprintf("\nupper limit : %s",upper))
result<-my_exp_dist(mylambda,lower,upper)
cat(sprintf("\n\nResult : \n%s",result))
})
)
}