weibull

Data series, how can i fit a distribution in R?

夙愿已清 提交于 2019-12-11 02:45:28
问题 I have some problems with a Data series because it has some zero values so there are some distributions who don't fit it. I've tried with the function fitdist and fitdistr but no one works. There are my data: Precp 28 8 0 107 339 231 308 226 302 333 163 92 48 17 101 327 424 338 559 184 238 371 413 261 12 24 103 137 300 446 94 313 402 245 147 70 8 5 59 109,2 493,6 374,5 399,3 330,5 183,8 341,1 91 127,5 15 69 165,8 337,9 255 309,3 352,7 437,5 420,4 295,6 141,7 3,4 16,2 58,9 55,5 203,1 235 300

How can I apply “sapply” in R with multiple codes in one function?

江枫思渺然 提交于 2019-12-10 21:54:29
问题 This question was migrated from Cross Validated because it can be answered on Stack Overflow. Migrated 6 years ago . I am a new R user. I have a simple sapply function example for calculating mean and sd for a splitted data frame. My data contains half hourly wind speed with direction. I want to know daily Weibull distribution for my study for 13 years. That is why my dataset is splitted based on time. My data looks like this: Time windspeed direction Date day_index 1 24/07/2000 13:00 31 310

Determine Weibull parameters from data

空扰寡人 提交于 2019-12-04 03:55:01
问题 I would like to identify the Weibull parameters (i.e. the shape and scale) of my data. 0.022988506 0.114942529 0.218390805 0.114942529 0.149425287 0.114942529 0.068965517 0.068965517 0.034482759 0.022988506 0.022988506 0.022988506 0.022988506 I've already tried what this answer proposed, and I'm using Python 3.4. import scipy.stats as s import numpy as np from scipy import stats def weib(x,n,a): return (a / n) * (x / n)**(a - 1) * np.exp(-(x / n)**a) data = np.loadtxt("data1.csv") print(data)

Scipy Weibull CDF calculation

此生再无相见时 提交于 2019-12-03 21:43:26
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. You haven't correctly mapped your parameters to those of scipy. To implement the equivalent of your weibCumDist : In [22]: x = 1000 In [23]: a = 1.5 In [24]: c = 5000 In [25]:

Plot survival and hazard function of survreg using curve()

江枫思渺然 提交于 2019-12-03 13:18:53
问题 I have the following survreg model: Call: survreg(formula = Surv(time = (ev.time), event = ev) ~ age, data = my.data, dist = "weib") Value Std. Error z p (Intercept) 4.0961 0.5566 7.36 1.86e-13 age 0.0388 0.0133 2.91 3.60e-03 Log(scale) 0.1421 0.1208 1.18 2.39e-01 Scale= 1.15 Weibull distribution I would like to plot the hazard function and the survival function based on the above estimates. I don't want to use predict() or pweibull() (as presented here Parametric Survival or here SO question

Interpreting Weibull parameters from survreg

生来就可爱ヽ(ⅴ<●) 提交于 2019-12-03 12:30:06
问题 I am trying to generate an inverse Weibull distribution using parameters estimated from survreg in R. By this I mean I would like to, for a given probability (which will be a random number in a small simulation model implemented in MS Excel), return the expected time to failure using my parameters. I understand the general form for the inverse Weibull distribution to be: X=b[-ln(1-rand())]^(1/a) where a and b are shape and scale parameters respectively and X is the time to failure I want. My

Interpreting Weibull parameters from survreg

冷暖自知 提交于 2019-12-03 03:36:53
I am trying to generate an inverse Weibull distribution using parameters estimated from survreg in R. By this I mean I would like to, for a given probability (which will be a random number in a small simulation model implemented in MS Excel), return the expected time to failure using my parameters. I understand the general form for the inverse Weibull distribution to be: X=b[-ln(1-rand())]^(1/a) where a and b are shape and scale parameters respectively and X is the time to failure I want. My problem is in the interpretation of the intercept and covariate parameters from survreg. I have these

Plot survival and hazard function of survreg using curve()

随声附和 提交于 2019-12-03 03:27:35
I have the following survreg model: Call: survreg(formula = Surv(time = (ev.time), event = ev) ~ age, data = my.data, dist = "weib") Value Std. Error z p (Intercept) 4.0961 0.5566 7.36 1.86e-13 age 0.0388 0.0133 2.91 3.60e-03 Log(scale) 0.1421 0.1208 1.18 2.39e-01 Scale= 1.15 Weibull distribution I would like to plot the hazard function and the survival function based on the above estimates. I don't want to use predict() or pweibull() (as presented here Parametric Survival or here SO question . I would like to use the curve() function. Any ideas how I can accomplish this? It seems the Weibull

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

本小妞迷上赌 提交于 2019-12-02 11:23:17
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, loc, scale = scipy.stats.weibull_min.fit(data,floc=1, f0=1) #constrain shape to be 1 blue curve loc:1

How to random sample a 2-parameter weibull distribution in python

别来无恙 提交于 2019-12-02 04:39:54
问题 I was wondering how to generate a random weibull distribution with 2-parameter (lambda, k) in python. I know that numpy has a numpy.random.weibull, but it only accepts the a parameter as the shape of the distribution. 回答1: Severin Pappadeux's answer is probably the simplest way to include the scale parameter. An alternative is to use scipy.stats.weibull_min. weibull_min has three parameters: shape, location and scale. You only want the shape and scale, so you would set the location to 0. from