-
Notifications
You must be signed in to change notification settings - Fork 2.8k
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
ENH: OLS with complex-valued data #3528
Comments
Interesting, I never heard of anyone using complex valued data with this. What is your use case? And do the regression results look correct? The problem here is that some of the distribution functions in scipy.special do not support complex numbers. And I have no idea what the statistical interpretation or definition of, for example, the cdf of the normal or chisquare distribution is. As possible solution:
Aside: many, but not all, models support complex numbers internally in the estimation, which we use in some cases for complex step derivatives. But there are currently no examples or unit tests for complex numbers beyond complex step derivatives. |
Here is a stackoverflow question http://stats.stackexchange.com/questions/66088/analysis-with-complex-data-anything-different I think the code needs to be checked for transpose versus conjugate transpose, especially if exog is also complex.
|
It seems difficult to find any literature on this, and some that I found is restricted pay access that I don't get. (The only applications that I can think of with complex endog are in frequency domain, fft or characteristic functions.) |
My use case consists in fitting two Fourier spectra, hence the complex-valued data. As shown in the updated code in my first post, the parameters of the regression are successfully found. However I wouldn't trust any of the statistical tests and other quality coefficients until I am sure they work as expected with complex-valued data (it's likely they don't). I am not familiar with statistics with complex data. If I find some time I'll try to find references about this. |
Wikipedia has an interesting page on complex normal distribution https://en.wikipedia.org/wiki/Complex_normal_distribution I found two overview articles for some basics for complex-valued data analysis and statistics. "Unfortunately, many fundamental statistical tools for handling complex-valued parameter estimators are missing or scattered in open literature." quote from Delmas Abeida, but the other has a similar sentence Delmas, Jean Pierre, and Habti Abeida. 2015. “Survey and Some New Results on Performance Analysis of Complex-Valued Parameter Estimators.” Signal Processing 111 (June): 210–21. doi:10.1016/j.sigpro.2014.12.009. Ollila, E., V. Koivunen, and H. V. Poor. 2011. “Complex-Valued Signal Processing - Essential Models, Tools and Statistics.” In 2011 Information Theory and Applications Workshop, 1–10. doi:10.1109/ITA.2011.5743596. Adali, T., and P. J. Schreier. 2014. “Optimization and Estimation of Complex-Valued Signals: Theory and Applications in Filtering and Blind Source Separation.” IEEE Signal Processing Magazine 31 (5): 112–28. doi:10.1109/MSP.2013.2287951. A few thoughts or points:
design question: wrapping complex into a internally real bivariate model or My guess is that the first is easier, when we have multivariate models like MultivariateOLS. |
I changed the title to indicate better that this is an enhancement, given that it is currently not supported. Related aside: we should add a Warning if exog is anything else except float64. |
This one looks like it has to go on the background reading list same authors as the 2011 paper above plus Tyler Ollila, E., D. E. Tyler, V. Koivunen, and H. V. Poor. 2012. “Complex Elliptically Symmetric Distributions: Survey, New Results and Applications.” IEEE Transactions on Signal Processing 60 (11): 5597–5625. doi:10.1109/TSP.2012.2212433. |
(I added this comment initially by mistake to #3530 ) One topic that seems to become popular recently in signal processing, is moving away from the circularity assumption e.g. and citing articles Adali, T., P. J. Schreier, and L. L. Scharf. 2011. “Complex-Valued Signal Processing: The Proper Way to Deal With Impropriety.” IEEE Transactions on Signal Processing 59 (11): 5101–25. doi:10.1109/TSP.2011.2162954. (based on reading abstract, looks too much details for now.) |
makes VAR work with complex variables Ticket: statsmodels#3528
new issue #9053 is duplicate quick try again using a modified example of first comment It looks more like OLS computes a vectorized OLS treating real and imaginary parts as separate regressions. possible cases
update
How should cov_params, specifically the |
search for regression, least squares Chang-Jun et al looks good as intro, with main references Miller 1973 (basic linear least squares) and Pincinbono 1994, 1995 (real and imaginary parts are correlated, widely linear estimation) Chang-Jun, Y. a. N., Zhang San-Guo, and Ning Wei. “Estimations of the Improper Linear Regression Models with Complex-Valued Data.” Journal of University of Chinese Academy of Sciences, no. 2 (March 15, 2012): 145. https://doi.org/10.7523/j.issn.2095-6134.2012.2.001. AFAICS, improper or noncircular residuals/noise have correlated real and imaginary parts. also the two definitions for cov of complex variables correspond to TBC |
I still don't find much on inference for complex-valued linear least squares basic idea AFAIU complex normal distribution is "equivalent" to bivariate normal distribution hypothesis testing for complex parameter beta so, for these H0 we can use F or chi2 distribution with 2 degrees of freedom (restrictions) related: asymptotics for the nonlinear least squares version Debasis Kundu (1991) Asymptotic properties of the complex valued nonlinear similarly to inference: not checked yet: |
I'm giving up here Miller 1973 looks good for the proper/circular case The improper, noncircular case and widely linear estimation is more difficult and requires some understanding of noncircular complex random variables. (including looking at definition of complex normal distribution again) Adali et al looks like a good overview, but requires work to go through the details Adali, Tülay, Peter J. Schreier, and Louis L. Scharf. “Complex-Valued Signal Processing: The Proper Way to Deal With Impropriety.” IEEE Transactions on Signal Processing 59, no. 11 (November 2011): 5101–25. https://doi.org/10.1109/TSP.2011.2162954. Picinbono, B. “On Circularity.” IEEE Transactions on Signal Processing 42, no. 12 (December 1994): 3473–82. https://doi.org/10.1109/78.340781. Picinbono, B., and P. Chevalier. “Widely Linear Estimation with Complex Data.” IEEE Transactions on Signal Processing 43, no. 8 (August 1995): 2030–33. https://doi.org/10.1109/78.403373. section 3.1 in the following has a list of properties of circular complex random variables (I did not look at the other parts) Agüero, Juan C., Juan I. Yuz, Graham C. Goodwin, and Ramón A. Delgado. “On the Equivalence of Time and Frequency Domain Maximum Likelihood Estimation.” Automatica 46, no. 2 (February 1, 2010): 260–70. https://doi.org/10.1016/j.automatica.2009.10.038. |
some of the comments above are incorrect or there are several definitions mixed up update update 2 |
original title: "Exception of RegressionResult.summary() when performing OLS with complex-valued data"
I am performing an ordinary least square (OLS) on complex-valued data. The OLS regression works as expected. However calling the method 'summary()' raises the following exception:
TypeError: ufunc 'chdtrc' not supported for the input types, and the inputs could not be safely coerced to any supported types according to the casting rule ''safe''
statsmodels version: 0.8.0
numpy version: 1.11.2
Python 3.5.2
Windows 7 64 bits
The text was updated successfully, but these errors were encountered: