weibull

Generate random data based on existing data

好久不见. 提交于 2021-02-16 14:52:16
问题 is there a way in python to generate random data based on the distribution of the alreday existing data? Here are the statistical parameters of my dataset: Data count 209.000000 mean 1.280144 std 0.374602 min 0.880000 25% 1.060000 50% 1.150000 75% 1.400000 max 4.140000 as it is no normal distribution it is not possible to do it with np.random.normal. Any Ideas? Thank you. Edit: Performing KDE: from sklearn.neighbors import KernelDensity # Gaussian KDE kde = KernelDensity(kernel='gaussian',

Weibull distribution with weighted data

半世苍凉 提交于 2021-02-11 13:31:08
问题 I have some time to event data that I need to generate around 200 shape/scale parameters for subgroups for a simulation model. I have analysed the data, and it best follows a weibull distribution. Normally, I would use the fitdistrplus package and fitdist(x, "weibull") to do so, however this data has been matched using kernel matching and I have a variable of weighting values called km and so needs to incorporate a weight, which isn't something fitdist can do as far as I can tell. With my

Weibull distribution with weighted data

前提是你 提交于 2021-02-11 13:31:04
问题 I have some time to event data that I need to generate around 200 shape/scale parameters for subgroups for a simulation model. I have analysed the data, and it best follows a weibull distribution. Normally, I would use the fitdistrplus package and fitdist(x, "weibull") to do so, however this data has been matched using kernel matching and I have a variable of weighting values called km and so needs to incorporate a weight, which isn't something fitdist can do as far as I can tell. With my

Goodness of fit test for Weibull distribution in python

给你一囗甜甜゛ 提交于 2020-07-21 03:32:42
问题 I have some data that I have to test to see if it comes from a Weibull distribution with unknown parameters. In R I could use https://cran.r-project.org/web/packages/KScorrect/index.html but I can't find anything in Python. Using scipy.stats I can fit parameters with: scipy.stats.weibull_min.fit(values) However in order to turn this into a test I think I need to perform some Monte-Carlo simulation (e.g. https://en.m.wikipedia.org/wiki/Lilliefors_test) I am not sure what to do exactly. How can

Goodness of fit test for Weibull distribution in python

ぃ、小莉子 提交于 2020-07-21 03:31:47
问题 I have some data that I have to test to see if it comes from a Weibull distribution with unknown parameters. In R I could use https://cran.r-project.org/web/packages/KScorrect/index.html but I can't find anything in Python. Using scipy.stats I can fit parameters with: scipy.stats.weibull_min.fit(values) However in order to turn this into a test I think I need to perform some Monte-Carlo simulation (e.g. https://en.m.wikipedia.org/wiki/Lilliefors_test) I am not sure what to do exactly. How can

How do I simulate a left truncated Weibull failure time data in R

*爱你&永不变心* 提交于 2020-06-29 04:08:27
问题 I want to simulate left truncated failure time data from Weibull distribution. My objective is to simulate data and retrieve the coefficients(of x1,x2,x3,x4, and x5 which I used for the simulation) by fitting a Weibull regression model. Here the xt=runif(N, 30, 80) denotes the start of the study, Tm <- qweibull(runif(N,pweibull(xt,shape = 7.5, scale = 82*exp(lp)),1), shape=7.5, scale=82*exp(lp)) variable denotes the failure time. But whenever I do the regression I am getting this warning

R: unexpected behavior of the fdwm() function (evmix package)

青春壹個敷衍的年華 提交于 2020-01-25 20:40:53
问题 I am trying to fit a dynamic mixture model (Weibull for the bulk, Pareto for the tail) using the fdwm() function from the evmix package: library(repmis) library(evmix) data=source_data("https://www.dropbox.com/s/r7i0ctl1czy481d/test.csv?dl=0")[,1] test=fdwm(data,c(0.9150062,75.4699181,quantile(data,0.98),11.21,87.41,0.05)) I am experiencing a weird behavior: the function first returns an error...: Error in integrate(rx, wshape, wscale, cmu = cmu, ctau = ctau, sigmau = sigmau, : non-finite

Weibull Distribution parameter estimation error

雨燕双飞 提交于 2020-01-06 08:28:13
问题 I used the following function to estimate the three-parameter Weibull distribution. library(bbmle) library(FAdist) set.seed(16) xl=rweibull3(50, shape = 1,scale=1, thres = 0) dweib3l <- function(shape, scale, thres) { -sum(dweibull3(xl , shape, scale, thres, log=TRUE)) } ml <- mle2(dweib3l, start= list(shape = 1, scale = 1, thres=0), data=list(xl)) However, when I run the above function I am getting the following error. Error in optim(par = c(shape = 1, scale = 1, thres = 0), fn = function (p

Scipy Weibull CDF calculation

戏子无情 提交于 2020-01-01 06:57:06
问题 I'm doing survival calculations in Scipy and can't get the correct values. My code: x, a, c = 1000, 1.5, 5000 vals = exponweib.cdf(x,a,c,loc=0,scale=1) Val should equal 0.085559356392783004, but I'm getting 0 instead. If I define my own function I get the right answer: def weibCumDist(x,a,c): return 1-np.exp(-(x/c)**a) I could just use my own function, but I'm curious as to what I'm doing wrong. Any suggestions? Thanks. 回答1: You haven't correctly mapped your parameters to those of scipy. To

Why are the parameters of weibull not unique for a given data?

安稳与你 提交于 2019-12-31 05:42:05
问题 I have a data which is the interval days of customers purchasing products. I try to estimate the shape and scale params by scipy.stat.weibull_min But, the parameters returned from the fit function is not unique and when I try to constrain the scale param to be 1, it does not work. Here is the three results with different ways for input: shape, loc, scale = scipy.stats.weibull_min.fit(data,floc=1,scale=1) #constrain scale to be 1 yellow curve loc:1 shape:0.7318249351 scale:75.22852953 shape,