Git Product home page Git Product logo

Comments (2)

lstorchi avatar lstorchi commented on May 25, 2024 1

Dear Manuel
thanks, actually googling a bit I was able to find out almost the same,
and indeed I already implemented it some dais ago it in my to be cleaned
minimal https://github.com/lstorchi/markovctheil/blob/master/copula_cli.py
copula CLI .

thanks again

from copulas.

ManuelAlvarezC avatar ManuelAlvarezC commented on May 25, 2024

Hi @lstorchi, and thanks for your questions,

I'm not Matlab expert, and the answers are based on what I've been able to grasp after reading the documentation of copulastat and copularnd modules, so please correct me if I'm wrong

r = copulastat('Gaussian',rho) returns the Kendall’s rank correlation, r, that corresponds to a Gaussian copula with linear correlation parameters rho.

If I'm not mistaken, what you intend to do, can't be done directly using our package, but can be done easily using pandas.DataFrame.corr directly on your raw data.

u = copularnd('Gaussian',rho,n) returns n random vectors generated from a Gaussian copula with linear correlation parameters rho.

We have not implemented a way to sample from a copula passing directly the linear correlation parameters. What we do is compute the correlation from the raw data, and when sampling, we return the sampled values in the same space that the raw data.

However, as the gaussian copula is based on the Gaussian Multivariate distribution, you can archieve this by doing:

import numpy as np

# We are assuming `rho` is your correlation parameters in a numpy.array
# We are assuming `n` is the number of vector you want to sample.

size = rho.shape[0]
means = np.zeros(size)
np.random.multivariate_normal(means, rho, size=n)

from copulas.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.