Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

kernels cosine differs from Stata #1245

Closed
josef-pkt opened this issue Dec 17, 2013 · 3 comments

Comments

Projects
None yet
1 participant
@josef-pkt
Copy link
Member

commented Dec 17, 2013

Our definition of the sandbox.nonparametric.kernels.Cosine differes from Stata

Stata uses
1 + cos(2� pi z) for |z| < 1/2 and 0 otherwise

I don't know what the normalization and _L2Norm is

we use

CustomKernel.__init__(self, shape=lambda x: 0.78539816339744828 *
                np.cos(np.pi/2.0 * x), h=h, domain=[-1.0, 1.0], norm = 1.0)
        self._L2Norm = np.pi**2/16.0

Wikipedia http://en.wikipedia.org/wiki/Kernel_(statistics)#Kernel_functions_in_common_use
has our Cosine kernel

@josef-pkt

This comment has been minimized.

Copy link
Member Author

commented Dec 17, 2013

I added Stata's version as Cosine2 kernel, unit tests for weighted kde pass against Stata's version in PR #1240

@josef-pkt

This comment has been minimized.

Copy link
Member Author

commented Dec 17, 2013

Stata also has a different epa kernel
and has parzen kernel, but no triweight kernel

@josef-pkt

This comment has been minimized.

Copy link
Member Author

commented Dec 17, 2013

statsmodels.regression.quantile_regression:
has the same Cosine as Stata, now Cosine2 in sandbox kernels,
epa is the same (and the same as epan2 in Stata)
it also has parzen

@josef-pkt josef-pkt closed this in 1aa494f Dec 18, 2013

josef-pkt added a commit that referenced this issue Dec 18, 2013

PierreBdR pushed a commit to PierreBdR/statsmodels that referenced this issue Sep 2, 2014

PierreBdR pushed a commit to PierreBdR/statsmodels that referenced this issue Sep 2, 2014

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.