Skip to content

Bivariate copula#3

Open
alvaror9554 wants to merge 19 commits into
chrischu12:bivariate_copulafrom
alvaror9554:bivariate_copula
Open

Bivariate copula#3
alvaror9554 wants to merge 19 commits into
chrischu12:bivariate_copulafrom
alvaror9554:bivariate_copula

Conversation

@alvaror9554

Copy link
Copy Markdown

Make a coment in the second derivative function.

- Fixed hardcoded 200 parameter bounds to use Frank-specific 20 bounds
- Enhanced Gram matrix regularization with adaptive conditioning
- Added weight validation safeguards for numerical stability
- Removed scaler-related NaN sources through proper bounds handling
- Frank copula now produces clean coefficients without NaN values
@alvaror9554

Copy link
Copy Markdown
Author

Changes in online_mvdistreg

- Removed obsolete test files and data
- Frank copula working with stable coefficients
- All NaN issues resolved with proper parameter bounds
alvaror9554 and others added 13 commits January 16, 2026 13:15
- Replace slow list comprehensions with vectorized st.t.ppf calls
- Vectorize st.t.pdf calculations for major speedup
- Apply optimizations to likelihood and derivative functions
- Achieve 4.1x performance improvement (90s -> 22s)
- Maintain 100% mathematical accuracy with same analytical formulas
- Change rho initialization from direct tau to sin(tau * pi/2) transformation
- Change nu default from 10 to 8 to match R VineCopula MLE method
- Improves compatibility with R BiCopEst initialization values
- Addresses numerical stability and convergence consistency
- Integrated R VineCopula compatibility improvements in bicop_studentt.py
- Applied performance optimizations from remote branch
- Resolved conflicts while preserving improved initial_values method
- Removed leftover merge conflict marker that was causing syntax errors
- File now compiles cleanly without red error indicators

# Calculate the gamma ratio using stable division
gamma_ratio = nu/2
gamma_ratio = stable_gamma_division((nu + 2.0) / 2.0, nu / 2.0)

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

leave at nu/2 please

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The change for nu has been corrected

except:
continue

def negative_log_likelihood(params):

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you define this in many functions at the same time, please define only once in the t copula

def get_regularization_size(self, dim: int) -> int:
return dim

def r_style_nu_optimization(self, y, initial_rho=None):

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is this used anywhere?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was a function to test the initial values in R, it is of no use now, I have already deleted it.

out = prediction
return out

def _df_iteration(self, y, rho_values):

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this must go in the copula function no?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes it should go into the copula. I already moved into bicop_studentt.py

rho_updated = theta[a][0].flatten()

# Optimize nu using DF iteration
optimal_nu = self._df_iteration(y, rho_updated)

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

but this means you also reoptimize even when you estimate nu using covariates, no?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, now we also re-optimize nu when covariates are used, so the nu update is refreshed with new data in this setup

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants