Hướng dẫn 2-parameter weibull distribution python - trăn phân phối weibull 2 ​​tham số

Tôi đã tự hỏi làm thế nào để tạo ra một phân phối Weibull ngẫu nhiên với 2 tham số (Lambda, K) trong Python. Tôi biết rằng Numpy có một Numpy.random.weibull, nhưng nó chỉ chấp nhận tham số A là hình dạng của phân phối.

Hỏi ngày 21 tháng 8 năm 2018 lúc 21:30Aug 21, 2018 at 21:30

Hướng dẫn 2-parameter weibull distribution python - trăn phân phối weibull 2 ​​tham số

Chà, nếu bạn lấy mẫu một số từ phân phối Weibull với tham số tỷ lệ bị thiếu (giả định tỷ lệ bằng 1), thì để có được tỷ lệ nhân với Lambda.

x = numpy.random.weibull(a)
return lambda*x

Đã trả lời ngày 21 tháng 8 năm 2018 lúc 21:51Aug 21, 2018 at 21:51

Hướng dẫn 2-parameter weibull distribution python - trăn phân phối weibull 2 ​​tham số

Câu trả lời của Severin Pappadeux có lẽ là cách đơn giản nhất để bao gồm tham số tỷ lệ. Một giải pháp thay thế là sử dụng

pd = 
  WeibullDistribution

  Weibull distribution
    A = 3321.64   [3157.65, 3494.15]
    B = 4.10083   [3.52497, 4.77076]

1.
pd = 
  WeibullDistribution

  Weibull distribution
    A = 3321.64   [3157.65, 3494.15]
    B = 4.10083   [3.52497, 4.77076]

2 có ba tham số: hình dạng, vị trí và tỷ lệ. Bạn chỉ muốn hình dạng và tỷ lệ, vì vậy bạn sẽ đặt vị trí thành 0.

from scipy.stats import weibull_min

n = 100     # number of samples
k = 2.4     # shape
lam = 5.5   # scale

x = weibull_min.rvs(k, loc=0, scale=lam, size=n)

Đã trả lời ngày 21 tháng 8 năm 2018 lúc 22:27Aug 21, 2018 at 22:27

Warren Weckesserwarren WeckesserWarren Weckesser

106K19 Huy hiệu vàng178 Huy hiệu bạc201 Huy hiệu đồng19 gold badges178 silver badges201 bronze badges

pd = 
  WeibullDistribution

  Weibull distribution
    A = 3321.64   [3157.65, 3494.15]
    B = 4.10083   [3.52497, 4.77076]

43 là các giá trị được làm tròn đến số nguyên gần nhất. Sau đó, bạn có thể coi các giá trị trong
pd = 
  WeibullDistribution

  Weibull distribution
    A = 3321.64   [3157.65, 3494.15]
    B = 4.10083   [3.52497, 4.77076]

43 là các quan sát được kiểm duyệt khoảng thời gian. Một quan sát
pd = 
  WeibullDistribution

  Weibull distribution
    A = 3321.64   [3157.65, 3494.15]
    B = 4.10083   [3.52497, 4.77076]

45 trong
pd = 
  WeibullDistribution

  Weibull distribution
    A = 3321.64   [3157.65, 3494.15]
    B = 4.10083   [3.52497, 4.77076]

43 chỉ ra rằng xếp hạng thực tế nằm trong khoảng từ
pd = 
  WeibullDistribution

  Weibull distribution
    A = 3321.64   [3157.65, 3494.15]
    B = 4.10083   [3.52497, 4.77076]

47 đến
pd = 
  WeibullDistribution

  Weibull distribution
    A = 3321.64   [3157.65, 3494.15]
    B = 4.10083   [3.52497, 4.77076]

48. Tạo một ma trận trong đó mỗi hàng đại diện cho khoảng thời gian xung quanh mỗi số nguyên trong
pd = 
  WeibullDistribution

  Weibull distribution
    A = 3321.64   [3157.65, 3494.15]
    B = 4.10083   [3.52497, 4.77076]

43.
pd = 
  WeibullDistribution

  Weibull distribution
    A = 3321.64   [3157.65, 3494.15]
    B = 4.10083   [3.52497, 4.77076]

2

Tìm lại MLES bằng cách sử dụng Show

  • Tải dữ liệu
  • Phù hợp với phân phối Weibull hai tham số
  • Xác định PDF tùy chỉnh cho phân phối Weibull ba tham số
  • Phù hợp với phân phối Weibull ba tham số
  • Phân phối Weibull ba tham số phù hợp cho B

Nội dung chínhShow

  • Tải dữ liệu
  • Phù hợp với phân phối Weibull hai tham số
  • Xác định PDF tùy chỉnh cho phân phối Weibull ba tham số
  • Phù hợp với phân phối Weibull ba tham số
  • Phân phối Weibull ba tham số phù hợp cho B

Nội dung chính

  • Tải dữ liệu
  • Phù hợp với phân phối Weibull hai tham số
  • Xác định PDF tùy chỉnh cho phân phối Weibull ba tham số
  • Phù hợp với phân phối Weibull ba tham số
  • Phân phối Weibull ba tham số phù hợp cho B

Nội dung chính

  • Phù hợp với phân phối Weibull hai tham số
  • Xác định PDF tùy chỉnh cho phân phối Weibull ba tham số
  • Phù hợp với phân phối Weibull ba tham số
  • Phân phối Weibull ba tham số phù hợp cho B
  • Nội dung chính

Nội phân chínhc).

Nội dung chínhc that are higher than the minimum value of

Nội phân chính

Nội phân chính

giá trị x cho y = 0,5:

import matplotlib.pyplot as plt
import numpy as np

def f(a,b,g,x):
   return  1 - (1 - g) * np.exp(-((x/a)**b)) 

x = np.linspace(0, 3, 100)
plt.figure(figsize=[4,3])
for a in [0.5,1,1.5]:
   y = f(a,2,0,x)
   plt.plot(x,y)
plt.show()

Độ dốc tại x = 1:

Chỉnh sửa: Để hoàn thiện, đây là mã hiển thị các biểu đồ:a and a shape parameter b in the probability distribution object
pd = 
  WeibullDistribution

  Weibull distribution
    A = 3321.64   [3157.65, 3494.15]
    B = 4.10083   [3.52497, 4.77076]

6 and distribution-specific functions such as
pd = 
  WeibullDistribution

  Weibull distribution
    A = 3321.64   [3157.65, 3494.15]
    B = 4.10083   [3.52497, 4.77076]

7 and
pd = 
  WeibullDistribution

  Weibull distribution
    A = 3321.64   [3157.65, 3494.15]
    B = 4.10083   [3.52497, 4.77076]

8. The Weibull distribution can take a third parameter. The three-parameter Weibull distribution adds a location parameter that is zero in the two-parameter case. If X has a two-parameter Weibull distribution, then Y=X+c has a three-parameter Weibull distribution with the added location parameter c.
pd = 
  WeibullDistribution

  Weibull distribution
    A = 3321.64   [3157.65, 3494.15]
    B = 4.10083   [3.52497, 4.77076]

6 và các hàm dành riêng cho phân phối như
pd = 
  WeibullDistribution

  Weibull distribution
    A = 3321.64   [3157.65, 3494.15]
    B = 4.10083   [3.52497, 4.77076]

7 và
pd = 
  WeibullDistribution

  Weibull distribution
    A = 3321.64   [3157.65, 3494.15]
    B = 4.10083   [3.52497, 4.77076]

8. Phân phối Weibull có thể lấy một tham số thứ ba. Phân phối Weibull ba tham số thêm một tham số vị trí bằng không trong trường hợp hai tham số. Nếu X có phân phối Weibull hai tham số, thì Y = X+C có phân phối Weibull ba tham số với tham số vị trí được thêm vào c.a and a shape parameter b in the probability distribution object
pd = 
  WeibullDistribution

  Weibull distribution
    A = 3321.64   [3157.65, 3494.15]
    B = 4.10083   [3.52497, 4.77076]

6 and distribution-specific functions such as
pd = 
  WeibullDistribution

  Weibull distribution
    A = 3321.64   [3157.65, 3494.15]
    B = 4.10083   [3.52497, 4.77076]

7 and
pd = 
  WeibullDistribution

  Weibull distribution
    A = 3321.64   [3157.65, 3494.15]
    B = 4.10083   [3.52497, 4.77076]

8. The Weibull distribution can take a third parameter. The three-parameter Weibull distribution adds a location parameter that is zero in the two-parameter case. If X has a two-parameter Weibull distribution, then Y=X+c has a three-parameter Weibull distribution with the added location parameter c.a and a shape parameter b in the probability distribution object
pd = 
  WeibullDistribution

  Weibull distribution
    A = 3321.64   [3157.65, 3494.15]
    B = 4.10083   [3.52497, 4.77076]

6 and distribution-specific functions such as
pd = 
  WeibullDistribution

  Weibull distribution
    A = 3321.64   [3157.65, 3494.15]
    B = 4.10083   [3.52497, 4.77076]

7 and
pd = 
  WeibullDistribution

  Weibull distribution
    A = 3321.64   [3157.65, 3494.15]
    B = 4.10083   [3.52497, 4.77076]

8. The Weibull distribution can take a third parameter. The three-parameter Weibull distribution adds a location parameter that is zero in the two-parameter case. If X has a two-parameter Weibull distribution, then Y=X+c has a three-parameter Weibull distribution with the added location parameter c.
pd = 
  WeibullDistribution

  Weibull distribution
    A = 3321.64   [3157.65, 3494.15]
    B = 4.10083   [3.52497, 4.77076]

6 và các hàm dành riêng cho phân phối như
pd = 
  WeibullDistribution

  Weibull distribution
    A = 3321.64   [3157.65, 3494.15]
    B = 4.10083   [3.52497, 4.77076]

7 và
pd = 
  WeibullDistribution

  Weibull distribution
    A = 3321.64   [3157.65, 3494.15]
    B = 4.10083   [3.52497, 4.77076]

8. Phân phối Weibull có thể lấy một tham số thứ ba. Phân phối Weibull ba tham số thêm một tham số vị trí bằng không trong trường hợp hai tham số. Nếu X có phân phối Weibull hai tham số, thì Y = X+C có phân phối Weibull ba tham số với tham số vị trí được thêm vào c.a and a shape parameter b in the probability distribution object
pd = 
  WeibullDistribution

  Weibull distribution
    A = 3321.64   [3157.65, 3494.15]
    B = 4.10083   [3.52497, 4.77076]

6 and distribution-specific functions such as
pd = 
  WeibullDistribution

  Weibull distribution
    A = 3321.64   [3157.65, 3494.15]
    B = 4.10083   [3.52497, 4.77076]

7 and
pd = 
  WeibullDistribution

  Weibull distribution
    A = 3321.64   [3157.65, 3494.15]
    B = 4.10083   [3.52497, 4.77076]

8. The Weibull distribution can take a third parameter. The three-parameter Weibull distribution adds a location parameter that is zero in the two-parameter case. If X has a two-parameter Weibull distribution, then Y=X+c has a three-parameter Weibull distribution with the added location parameter c.

Thống kê và công cụ học máy ™ sử dụng phân phối Weibull hai tham số với tham số tỷ lệ A và tham số hình B trong đối tượng phân phối xác suất a and a shape parameter b in the probability distribution object

pd = 
  WeibullDistribution

  Weibull distribution
    A = 3321.64   [3157.65, 3494.15]
    B = 4.10083   [3.52497, 4.77076]

6 and distribution-specific functions such as
pd = 
  WeibullDistribution

  Weibull distribution
    A = 3321.64   [3157.65, 3494.15]
    B = 4.10083   [3.52497, 4.77076]

7 and
pd = 
  WeibullDistribution

  Weibull distribution
    A = 3321.64   [3157.65, 3494.15]
    B = 4.10083   [3.52497, 4.77076]

8. The Weibull distribution can take a third parameter. The three-parameter Weibull distribution adds a location parameter that is zero in the two-parameter case. If X has a two-parameter Weibull distribution, then Y=X+c has a three-parameter Weibull distribution with the added location parameter c.
pd = 
  WeibullDistribution

  Weibull distribution
    A = 3321.64   [3157.65, 3494.15]
    B = 4.10083   [3.52497, 4.77076]

6 và các hàm dành riêng cho phân phối như
pd = 
  WeibullDistribution

  Weibull distribution
    A = 3321.64   [3157.65, 3494.15]
    B = 4.10083   [3.52497, 4.77076]

7 và
pd = 
  WeibullDistribution

  Weibull distribution
    A = 3321.64   [3157.65, 3494.15]
    B = 4.10083   [3.52497, 4.77076]

8. Phân phối Weibull có thể lấy một tham số thứ ba. Phân phối Weibull ba tham số thêm một tham số vị trí bằng không trong trường hợp hai tham số. Nếu X có phân phối Weibull hai tham số, thì Y = X+C có phân phối Weibull ba tham số với tham số vị trí được thêm vào c.a and a shape parameter b in the probability distribution object
pd = 
  WeibullDistribution

  Weibull distribution
    A = 3321.64   [3157.65, 3494.15]
    B = 4.10083   [3.52497, 4.77076]

6 and distribution-specific functions such as
pd = 
  WeibullDistribution

  Weibull distribution
    A = 3321.64   [3157.65, 3494.15]
    B = 4.10083   [3.52497, 4.77076]

7 and
pd = 
  WeibullDistribution

  Weibull distribution
    A = 3321.64   [3157.65, 3494.15]
    B = 4.10083   [3.52497, 4.77076]

8. The Weibull distribution can take a third parameter. The three-parameter Weibull distribution adds a location parameter that is zero in the two-parameter case. If X has a two-parameter Weibull distribution, then Y=X+c has a three-parameter Weibull distribution with the added location parameter c.

Hàm mật độ xác suất (PDF) của phân phối Weibull ba tham số trở thànha and b are positive values, and c is a real value. a and b are positive values, and c is a real value.

f (x | a, b, c) = {ba (x- ca) b-1Exp (-(x-ca) b) if & nbsp; x> c, 0 if & nbsp; x≤c,a and b are positive values, and c is a real value. b is less than 1, the probability density of the Weibull distribution approaches infinity as x approaches c. The maximum of the likelihood function is infinite. The software might find satisfactory estimates in some cases, but the global maximum is degenerate when bb is less than 1, the probability density of the Weibull distribution approaches infinity as x approaches c. The maximum of the likelihood function is infinite. The software might find satisfactory estimates in some cases, but the global maximum is degenerate when b<1.

Trong đó A và B là giá trị dương và C là một giá trị thực.a and b are positive values, and c is a real value. b is less than 1, the probability density of the Weibull distribution approaches infinity as x approaches c. The maximum of the likelihood function is infinite. The software might find satisfactory estimates in some cases, but the global maximum is degenerate when b

Nếu tham số tỷ lệ B nhỏ hơn 1, mật độ xác suất của phân phối Weibull tiếp cận vô cực khi X tiếp cận c. Tối đa của hàm khả năng là vô hạn. Phần mềm có thể tìm thấy các ước tính thỏa đáng trong một số trường hợp, nhưng mức tối đa toàn cầu bị thoái hóa khi Bb is less than 1, the probability density of the Weibull distribution approaches infinity as x approaches c. The maximum of the likelihood function is infinite. The software might find satisfactory estimates in some cases, but the global maximum is degenerate when bbb<1.

Tải dữ liệu

Ví dụ này cho thấy cách tìm các ước tính khả năng tối đa (MLES) cho phân phối Weibull ba tham số bằng cách sử dụng PDF được xác định tùy chỉnh và hàm b

Phù hợp với phân phối Weibull hai tham số

Xác định PDF tùy chỉnh cho phân phối Weibull ba tham số

pd = 
  WeibullDistribution

  Weibull distribution
    A = 3321.64   [3157.65, 3494.15]
    B = 4.10083   [3.52497, 4.77076]

0
pd = 
  WeibullDistribution

  Weibull distribution
    A = 3321.64   [3157.65, 3494.15]
    B = 4.10083   [3.52497, 4.77076]

Phù hợp với phân phối Weibull ba tham số

pd = 
  WeibullDistribution

  Weibull distribution
    A = 3321.64   [3157.65, 3494.15]
    B = 4.10083   [3.52497, 4.77076]

1

Phân phối Weibull ba tham số phù hợp cho B

pd = 
  WeibullDistribution

  Weibull distribution
    A = 3321.64   [3157.65, 3494.15]
    B = 4.10083   [3.52497, 4.77076]

3
pd = 
  WeibullDistribution

  Weibull distribution
    A = 3321.64   [3157.65, 3494.15]
    B = 4.10083   [3.52497, 4.77076]

4
pd = 
  WeibullDistribution

  Weibull distribution
    A = 3321.64   [3157.65, 3494.15]
    B = 4.10083   [3.52497, 4.77076]

5

Nội dung chính

Nội phân chínhc).c).

Xác định PDF tùy chỉnh cho phân phối Weibull ba tham số

Phù hợp với phân phối Weibull ba tham số

pd = 
  WeibullDistribution

  Weibull distribution
    A = 3321.64   [3157.65, 3494.15]
    B = 4.10083   [3.52497, 4.77076]

6

Phân phối Weibull ba tham số phù hợp cho B

pd = 
  WeibullDistribution

  Weibull distribution
    A = 3321.64   [3157.65, 3494.15]
    B = 4.10083   [3.52497, 4.77076]

7

Phù hợp với phân phối Weibull ba tham số

Phân phối Weibull ba tham số phù hợp cho B

pd = 
  WeibullDistribution

  Weibull distribution
    A = 3321.64   [3157.65, 3494.15]
    B = 4.10083   [3.52497, 4.77076]

8
pd = 
  WeibullDistribution

  Weibull distribution
    A = 3321.64   [3157.65, 3494.15]
    B = 4.10083   [3.52497, 4.77076]

00

Nội dung chínhc that are higher than the minimum value of c that are higher than the minimum value of

Nội phân chính

Nội phân chính

Chủ đề liên quan

pd = 
  WeibullDistribution

  Weibull distribution
    A = 3321.64   [3157.65, 3494.15]
    B = 4.10083   [3.52497, 4.77076]

01

StackOverflow không thể hiển thị các công thức toán học (latex), do đó các công thức được đưa ra dưới dạng hình ảnh.

pd = 
  WeibullDistribution

  Weibull distribution
    A = 3321.64   [3157.65, 3494.15]
    B = 4.10083   [3.52497, 4.77076]

02

giá trị x cho y = 0,5:

pd = 
  WeibullDistribution

  Weibull distribution
    A = 3321.64   [3157.65, 3494.15]
    B = 4.10083   [3.52497, 4.77076]

03
pd = 
  WeibullDistribution

  Weibull distribution
    A = 3321.64   [3157.65, 3494.15]
    B = 4.10083   [3.52497, 4.77076]

04

Độ dốc tại x = 1:

pd = 
  WeibullDistribution

  Weibull distribution
    A = 3321.64   [3157.65, 3494.15]
    B = 4.10083   [3.52497, 4.77076]

05

Chỉnh sửa: Để hoàn thiện, đây là mã hiển thị các biểu đồ:

Phân phối Weibull ba tham số phù hợp cho B

Nội dung chínhc that are higher than the minimum value of b is less than 1, the pdf of the Weibull distribution approaches infinity near the lower limit c (location parameter). You can avoid this problem by specifying interval-censored data, if appropriate.

Nội phân chính

Chủ đề liên quan

StackOverflow không thể hiển thị các công thức toán học (latex), do đó các công thức được đưa ra dưới dạng hình ảnh.

pd = 
  WeibullDistribution

  Weibull distribution
    A = 3321.64   [3157.65, 3494.15]
    B = 4.10083   [3.52497, 4.77076]

06
pd = 
  WeibullDistribution

  Weibull distribution
    A = 3321.64   [3157.65, 3494.15]
    B = 4.10083   [3.52497, 4.77076]

07
pd = 
  WeibullDistribution

  Weibull distribution
    A = 3321.64   [3157.65, 3494.15]
    B = 4.10083   [3.52497, 4.77076]

08

giá trị x cho y = 0,5:

Độ dốc tại x = 1:

Chỉnh sửa: Để hoàn thiện, đây là mã hiển thị các biểu đồ:

Nội phân chínhb is less than 1, the pdf of the Weibull distribution approaches infinity near the lower limit c (location parameter). You can avoid this problem by specifying interval-censored data, if appropriate. b is less than 1, the pdf of the Weibull distribution approaches infinity near the lower limit c (location parameter). You can avoid this problem by specifying interval-censored data, if appropriate.

Tải tập dữ liệu

pd = 
  WeibullDistribution

  Weibull distribution
    A = 3321.64   [3157.65, 3494.15]
    B = 4.10083   [3.52497, 4.77076]

40. Dữ liệu bao gồm xếp hạng cho chín chỉ số khác nhau về chất lượng cuộc sống ở 329 thành phố của Hoa Kỳ: khí hậu, nhà ở, y tế, tội phạm, giao thông, giáo dục, nghệ thuật, giải trí và kinh tế. Đối với mỗi chỉ số, xếp hạng cao hơn là tốt hơn.

Tìm MLES cho chỉ số thứ bảy (nghệ thuật).

Thông điệp cảnh báo chỉ ra rằng ước tính không hội tụ. Sửa đổi các tùy chọn ước tính và tìm lại MLES. Tăng số lượng lặp tối đa (

pd = 
  WeibullDistribution

  Weibull distribution
    A = 3321.64   [3157.65, 3494.15]
    B = 4.10083   [3.52497, 4.77076]

41) và số lượng đánh giá chức năng mục tiêu tối đa (
pd = 
  WeibullDistribution

  Weibull distribution
    A = 3321.64   [3157.65, 3494.15]
    B = 4.10083   [3.52497, 4.77076]

42).
pd = 
  WeibullDistribution

  Weibull distribution
    A = 3321.64   [3157.65, 3494.15]
    B = 4.10083   [3.52497, 4.77076]

09
pd = 
  WeibullDistribution

  Weibull distribution
    A = 3321.64   [3157.65, 3494.15]
    B = 4.10083   [3.52497, 4.77076]

0
pd = 
  WeibullDistribution

  Weibull distribution
    A = 3321.64   [3157.65, 3494.15]
    B = 4.10083   [3.52497, 4.77076]

1

pd = 
  WeibullDistribution

  Weibull distribution
    A = 3321.64   [3157.65, 3494.15]
    B = 4.10083   [3.52497, 4.77076]

5

Việc lặp lại vẫn không hội tụ vì PDF tiếp cận vô cực gần giới hạn dưới.

Giả sử rằng các chỉ số trong

pd = 
  WeibullDistribution

  Weibull distribution
    A = 3321.64   [3157.65, 3494.15]
    B = 4.10083   [3.52497, 4.77076]

43 là các giá trị được làm tròn đến số nguyên gần nhất. Sau đó, bạn có thể coi các giá trị trong
pd = 
  WeibullDistribution

  Weibull distribution
    A = 3321.64   [3157.65, 3494.15]
    B = 4.10083   [3.52497, 4.77076]

43 là các quan sát được kiểm duyệt khoảng thời gian. Một quan sát
pd = 
  WeibullDistribution

  Weibull distribution
    A = 3321.64   [3157.65, 3494.15]
    B = 4.10083   [3.52497, 4.77076]

45 trong
pd = 
  WeibullDistribution

  Weibull distribution
    A = 3321.64   [3157.65, 3494.15]
    B = 4.10083   [3.52497, 4.77076]

43 chỉ ra rằng xếp hạng thực tế nằm trong khoảng từ
pd = 
  WeibullDistribution

  Weibull distribution
    A = 3321.64   [3157.65, 3494.15]
    B = 4.10083   [3.52497, 4.77076]

47 đến
pd = 
  WeibullDistribution

  Weibull distribution
    A = 3321.64   [3157.65, 3494.15]
    B = 4.10083   [3.52497, 4.77076]

48. Tạo một ma trận trong đó mỗi hàng đại diện cho khoảng thời gian xung quanh mỗi số nguyên trong
pd = 
  WeibullDistribution

  Weibull distribution
    A = 3321.64   [3157.65, 3494.15]
    B = 4.10083   [3.52497, 4.77076]

43.
pd = 
  WeibullDistribution

  Weibull distribution
    A = 3321.64   [3157.65, 3494.15]
    B = 4.10083   [3.52497, 4.77076]

2
pd = 
  WeibullDistribution

  Weibull distribution
    A = 3321.64   [3157.65, 3494.15]
    B = 4.10083   [3.52497, 4.77076]

9
|
pd = 
  WeibullDistribution

  Weibull distribution
    A = 3321.64   [3157.65, 3494.15]
    B = 4.10083   [3.52497, 4.77076]

8
|
pd = 
  WeibullDistribution

  Weibull distribution
    A = 3321.64   [3157.65, 3494.15]
    B = 4.10083   [3.52497, 4.77076]

7
  • Tìm lại MLES bằng cách sử dụng