Abubakari commited on
Commit
a7663b4
1 Parent(s): 55defa0

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +25 -0
app.py CHANGED
@@ -12,6 +12,16 @@ def Phi(z):
12
  def phi(z):
13
  return norm.pdf(z)
14
 
 
 
 
 
 
 
 
 
 
 
15
  def f_BCNOLLN(y1, y2, mu1, sigma1, alpha1, beta1, mu2, sigma2, alpha2, beta2, lambd):
16
  z1 = (y1 - mu1) / sigma1
17
  z2 = (y2 - mu2) / sigma2
@@ -55,6 +65,10 @@ y1, y2 = np.meshgrid(np.linspace(-3, 3, 100), np.linspace(-3, 3, 100))
55
  # Calculate PDF values
56
  pdf_values = f_BCNOLLN(y1, y2, mu1, sigma1, alpha1, beta1, mu2, sigma2, alpha2, beta2, lambd)
57
 
 
 
 
 
58
  # Plotting
59
  #fig, ax = plt.subplots()
60
  #cp = ax.contourf(y1, y2, pdf_values, cmap='viridis')
@@ -76,5 +90,16 @@ fig.update_layout(title='BCNOLLN PDF 3D Contour Plot', autosize=True,
76
  # Display the plot in Streamlit
77
  st.plotly_chart(fig)
78
 
 
 
 
 
 
 
 
 
 
 
 
79
 
80
  #st.pyplot(fig)
 
12
  def phi(z):
13
  return norm.pdf(z)
14
 
15
+
16
+ def F_BCNOLLN(y1, y2, params):
17
+ z1 = (y1 - mu_1) / sigma_1
18
+ z2 = (y2 - mu_2) / sigma_2
19
+ term = (Phi(z1)*params["alpha_1"] / H(z1, params["alpha_1"], params["beta_1"]))*(-params["lambda_val"]) + \
20
+ (Phi(z2)*params["alpha_2"] / H(z2, params["alpha_2"], params["beta_2"]))*(-params["lambda_val"]) - 1
21
+ return term**(-1/params["lambda_val"])
22
+
23
+
24
+
25
  def f_BCNOLLN(y1, y2, mu1, sigma1, alpha1, beta1, mu2, sigma2, alpha2, beta2, lambd):
26
  z1 = (y1 - mu1) / sigma1
27
  z2 = (y2 - mu2) / sigma2
 
65
  # Calculate PDF values
66
  pdf_values = f_BCNOLLN(y1, y2, mu1, sigma1, alpha1, beta1, mu2, sigma2, alpha2, beta2, lambd)
67
 
68
+ # Calculate CDF values
69
+ cdf_values = F_BCNOLLN(y1, y2, mu1, sigma1, alpha1, beta1, mu2, sigma2, alpha2, beta2, lambd)
70
+
71
+
72
  # Plotting
73
  #fig, ax = plt.subplots()
74
  #cp = ax.contourf(y1, y2, pdf_values, cmap='viridis')
 
90
  # Display the plot in Streamlit
91
  st.plotly_chart(fig)
92
 
93
+ # Create a 3D contour plot with Plotly
94
+ fig = go.Figure(data=[go.Surface(z=cdf_values, x=y1, y=y2, colorscale='Viridis')])
95
+ fig.update_layout(title='BCNOLLN CDF 3D Contour Plot', autosize=True,
96
+ scene=dict(
97
+ xaxis_title='y1',
98
+ yaxis_title='y2',
99
+ zaxis_title='PDF'
100
+ ))
101
+
102
+ # Display the plot in Streamlit
103
+ st.plotly_chart(fig)
104
 
105
  #st.pyplot(fig)