Skip to content

Small bugs in SimpleRegressionResults #2375

Closed
nilearn/nistats
#174
@qmac

Description

@qmac

(1) https://github.com/nistats/nistats/blob/master/nistats/regression.py#L366
predicted should be a method call instead of an instance variable reference

Traceback (most recent call last):
  File "nistats_model_fitting.py", line 22, in compute_rsquared
    print(model.results_[0][0.0].resid(Y))
  File "/.../nistats/nistats/regression.py", line 366, in resid
    return Y - self.predicted
TypeError: unsupported operand type(s) for -: 'float' and 'method'

(2) https://github.com/nistats/nistats/blob/master/nistats/regression.py#L392
model is not defined in SimpleRegressionResults. It is defined in the parent class LikelihoodModelResults but the initializer for the parent is never called.

Traceback (most recent call last):
  File "nistats_model_fitting.py", line 22, in compute_rsquared
    print(model.results_[0][0.0].predicted())
  File "/.../nistats/nistats/regression.py", line 392, in predicted
    X = self.model.design
AttributeError: 'SimpleRegressionResults' object has no attribute 'model'

Metadata

Metadata

Labels

GLMIssues/PRs related to the nilearn.glm module.

Type

Projects

Status

Done

Relationships

None yet

Development

No branches or pull requests

Issue actions