This works:
x <- c(23,19,37,38,40,36,172,48,113,90,54,104,90,54,157,51,77,78,144,34,29,45,16,15,37,218,170,44,121)
rate <- c(.01,.02,.04,.05,.1,.2,.3,.4,.5,.8,.9)
year <- c(100,50,25,20,10,5,3.3,2.5,2,1.2,1.1)
library(MASS)
x <- sort(x)
tryCatch(
f<-fitdistr(x, 'weibull'),
error = function(e) cat(as.character(e))
)
shape = f$estimate["shape"]
scale = f$estimate["scale"]
cat(shape,scale,"\n")
for (i in 1:length(rate)){
cat(scale*(-log(rate[i]))^(1/shape))
cat(",")
}
x <- c(23,19,37,38,40,36,172,48,113,90,54,104,90,54,157,51,77,78,144,34,29,45,16,15,37,218,170,44,121)
rate <- c(.01,.02,.04,.05,.1,.2,.3,.4,.5,.8,.9)
year <- c(100,50,25,20,10,5,3.3,2.5,2,1.2,1.1)
library(MASS)
x <- sort(x)
tryCatch(
f<-fitdistr(x, 'weibull'),
error = function(e) cat(as.character(e))
)
shape = f$estimate["shape"]
scale = f$estimate["scale"]
cat(shape,scale,"\n")
for (i in 1:length(rate)){
cat(scale*(-log(rate[i]))^(1/shape))
cat(",")
}
No comments:
Post a Comment
Thank you