Skip to content

DOC: stats.gaussian_kde: clarify the meaning of factor #22581

@zbaibg

Description

@zbaibg

Issue with current documentation:

The relationship between kde.factor, dataset's covariance and kde.covariance is not clear in the following pages.

https://docs.scipy.org/doc/scipy/reference/generated/scipy.stats.gaussian_kde.html
“factor float: The bandwidth factor, obtained from kde.covariance_factor. The square of kde.factor multiplies the covariance matrix of the data in the kde estimation.” needs to be clarified to be:
“factor float: The bandwidth factor, obtained from kde.covariance_factor. The covariance matrix of the data in the kde estimation multiplied by the square of kde.factor is the kernel covariance matrix (which means the square of the bandwidth in 1d dataset.)

https://docs.scipy.org/doc/scipy/reference/generated/scipy.stats.gaussian_kde.covariance_factor.html#scipy.stats.gaussian_kde.covariance_factor
“Computes the coefficient (kde.factor) that multiplies the data covariance matrix to obtain the kernel covariance matrix. " needs to be clarified to be:

"Computes the coefficient (kde.factor). The square of kde.factor multiplies the data covariance matrix to obtain the kernel covariance matrix."

It takes me a while to figure out the relationship. The "factor" is not easy to be understanded as "bandwidth". I also see some people confused on the same question at stack overflow: https://stackoverflow.com/questions/23630515/getting-bandwidth-used-by-scipys-gaussian-kde-function

Idea or request for content:

No response

Additional context (e.g. screenshots, GIFs)

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    DocumentationIssues related to the SciPy documentation. Also check https://github.com/scipy/scipy.orgscipy.stats

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions