-
Notifications
You must be signed in to change notification settings - Fork 1
/
pred_naive_indiv.R
25 lines (19 loc) · 913 Bytes
/
pred_naive_indiv.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
library(nleqslv)
#library(pracma)
interval_naive <- matrix(ncol = 2)
for (sample in 1:100) {
t_i <- time[sample]
fn_l <- function(tx) {
#f = (exp(-(t_i/scale_lt)^shape_lt)-exp(-(t/scale_lt)^shape_lt))/(1-exp(-(t_i/scale_lt)^shape_lt))
return(0.05 - (exp(-(t_i / scale_lt) ^ shape_lt) - exp(-(tx / scale_lt) ^
shape_lt)) / (exp(-(t_i / scale_lt) ^ shape_lt)))
}
T_l_naive <- nleqslv(100, fn_l)$x
fn_u <- function(tx) {
#f = (exp(-(t_i/scale_lt)^shape_lt)-exp(-(t/scale_lt)^shape_lt))/(1-exp(-(t_i/scale_lt)^shape_lt))
return(0.95 - (exp(-(t_i / scale_lt) ^ shape_lt) - exp(-(tx / scale_lt) ^
shape_lt)) / (exp(-(t_i / scale_lt) ^ shape_lt)))
}
T_u_naive <- nleqslv(100, fn_u)$x
interval_naive <- rbind(interval_naive, c(T_l_naive, T_u_naive))
}