You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have been thinking for a while to add some shortcut and stripped down linear models into regression.
Stripped down means that not all functionality and results are available, i.e. "limited" models.
One possible suggestion for the module name is special_linear_model.
I thought of simplified as a name but it's a misnomer.
examples:
OLS based on summary statistic (e.g. covariance matrix)
The parallel regression would be very useful. We often need to regress 1 y vector against many (say, 20K) x vectors in separate regressions (e.g. 20k separate regressions). Sometimes there are also additional variables z that need to go into every regression. For example, if y is a phenotype, x represents different genes that you want to assess one-at-a-time, and the z's are control variables.
Would also be useful to have this for logistic regression but that's a bit more work to implement efficiently.
@kshedden do you really mean one endog y and many exog x?
The common case in neuroimaging about which we had the discussion before was one exog x, but many endog y (on time series for each pixel). Same with parameteric bootstrap.
Both can reuse a pinv(exog) or solve the linear least squares problem with a 2-dim y.
Is there a common structure in the many exog case that would make computational savings possible?
I have seen a github repo (which I don't remember) that copied our GLM and vectorized it for multiple/multivariate endog, IIRC. I didn't check the details.
A typical example is that you have an outcome, say blood pressure, and you
are looking for molecular predictors ('markers') of it. You have some sort
of large-scale assay that measures thousands of candidate markers, the vast
majority of which will be irrelevant. The basic "screening" analysis is to
calculate the correlation coefficient between the outcome and each of the
markers. A slightly more sophisticated version is where you have controls
like gender and age and you want to fit multiple regression models of the
outcome against one marker at a time and all the controls. Of course some
people would also want to build models including several markers at a time,
but this goes beyond what I am thinking of here.
It's not a huge deal computationally to just loop over the markers and fit
thousands of models one-at-a-time. But using some basic matrix
factorizations you can do it all in just a few steps. I wouldn't want to
reproduce everything that's in a statsmodels OLS result, just the
parameters, fitted values, residuals, and other things that can be obtained
in one step using linear algebra.
I've done the imaging version of this too, where you have many voxels
(dependent variables) regressed against covariates (stimulus type, time,
etc.). This can also be set up as a different type of parallel regression.
So I think a parallel regression could be quite useful.
On Fri, Jan 23, 2015 at 2:49 PM, Josef Perktold [email protected]
wrote:
The common case in neuroimaging about which we had the discussion before
was one exog x, but many endog y (on time series for each pixel). Same
with parameteric bootstrap.
Both can reuse a pinv(exog) or solve the linear least squares problem with
a 2-dim y.
Is there a common structure in the many exog case that would make
computational savings possible?
—
Reply to this email directly or view it on GitHub #2203 (comment)
.
I wouldn't want to reproduce everything that's in a statsmodels OLS result, just the
parameters, fitted values, residuals, and other things that can be obtained in one step
using linear algebra.
Yes, that's what I meant with stripped down version, and the use cases I had in mind. If the need arises we could add later some other things that will be slow or require large arrays.
The docstrings should make it clear that these are limited purpose special versions and the use case for which they are designed.
If you have a vectorized linear algebra version for your use case, then we could get started with this once 0.7 is out the door. I have some experimental version for some of the other cases, where I was trying to figure out the required calculations.
I was thinking of working with skeleton versions of the current model-results class pattern, but where most things won't be inherited because our current framework won't be able to handle most of the special data structures and features.
@kshedden do you really mean one endog y and many exog x?
The common case in neuroimaging about which we had the discussion before was one exog x, but many endog y (on time series for each pixel). Same with parameteric bootstrap.
Both can reuse a pinv(exog) or solve the linear least squares problem with a 2-dim y.
Is there a common structure in the many exog case that would make computational savings possible?
My use case is almost exactly that (EEG data, different y for each channel for each timepoint, but potentially different X's).
Activity
josef-pkt commentedon Jan 23, 2015
issue mainly to park the idea for a module name.
kshedden commentedon Jan 23, 2015
The parallel regression would be very useful. We often need to regress 1 y vector against many (say, 20K) x vectors in separate regressions (e.g. 20k separate regressions). Sometimes there are also additional variables z that need to go into every regression. For example, if y is a phenotype, x represents different genes that you want to assess one-at-a-time, and the z's are control variables.
Would also be useful to have this for logistic regression but that's a bit more work to implement efficiently.
josef-pkt commentedon Jan 23, 2015
@kshedden do you really mean one
endogy and manyexogx?The common case in neuroimaging about which we had the discussion before was one
exogx, but many endogy(on time series for each pixel). Same with parameteric bootstrap.Both can reuse a pinv(exog) or solve the linear least squares problem with a 2-dim y.
Is there a common structure in the many
exogcase that would make computational savings possible?josef-pkt commentedon Jan 23, 2015
I have seen a github repo (which I don't remember) that copied our GLM and vectorized it for multiple/multivariate endog, IIRC. I didn't check the details.
kshedden commentedon Jan 24, 2015
A typical example is that you have an outcome, say blood pressure, and you
are looking for molecular predictors ('markers') of it. You have some sort
of large-scale assay that measures thousands of candidate markers, the vast
majority of which will be irrelevant. The basic "screening" analysis is to
calculate the correlation coefficient between the outcome and each of the
markers. A slightly more sophisticated version is where you have controls
like gender and age and you want to fit multiple regression models of the
outcome against one marker at a time and all the controls. Of course some
people would also want to build models including several markers at a time,
but this goes beyond what I am thinking of here.
It's not a huge deal computationally to just loop over the markers and fit
thousands of models one-at-a-time. But using some basic matrix
factorizations you can do it all in just a few steps. I wouldn't want to
reproduce everything that's in a statsmodels OLS result, just the
parameters, fitted values, residuals, and other things that can be obtained
in one step using linear algebra.
I've done the imaging version of this too, where you have many voxels
(dependent variables) regressed against covariates (stimulus type, time,
etc.). This can also be set up as a different type of parallel regression.
So I think a parallel regression could be quite useful.
On Fri, Jan 23, 2015 at 2:49 PM, Josef Perktold [email protected]
wrote:
josef-pkt commentedon Jan 24, 2015
Yes, that's what I meant with stripped down version, and the use cases I had in mind. If the need arises we could add later some other things that will be slow or require large arrays.
The docstrings should make it clear that these are limited purpose special versions and the use case for which they are designed.
If you have a vectorized linear algebra version for your use case, then we could get started with this once 0.7 is out the door. I have some experimental version for some of the other cases, where I was trying to figure out the required calculations.
I was thinking of working with skeleton versions of the current model-results class pattern, but where most things won't be inherited because our current framework won't be able to handle most of the special data structures and features.
andportnoy commentedon Nov 14, 2018
My use case is almost exactly that (EEG data, different
yfor each channel for each timepoint, but potentially differentX's).