Skip to content

Conversation

@mousum-github
Copy link
Collaborator

I have added most of the test cases as discussed in #499.

Also, I have changed the residuals function for lm. Now the residuals function for lm is similar to residuals function in 'glm'.
Although, I am not sure about applicability of :working type residuals in lm. R supports :working type residuals in lm and which is same as :response type.

@ViralBShah
Copy link
Contributor

This PR seems to be picking up some older commits and needs cleaning up.

@mousum-github
Copy link
Collaborator Author

Thanks, Viral.
I will check it this week.

@mousum-github
Copy link
Collaborator Author

The PR is now cleaned up and merged with the latest master branch.

@mousum-github mousum-github requested a review from palday October 7, 2023 10:05
import Base: (\), convert, show, size
import LinearAlgebra: cholesky, cholesky!
import Statistics: cor
using StatsAPI
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it should be in using part

residuals(obj::LinPredModel) = residuals(obj.rr)

function formula(obj::LinPredModel)
function residuals(model::LinPredModel; type=:deviance)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I do not know the details of the implementation, but is the residuals method properly documented (as it is not documented here). I.e. that it supports type kwarg and what is the behavior depending on the value of the kwarg.

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is documented on line 847 of glmfit.jl

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That docstring is attached only to the method for GeneralizedLinearModel. It should be attached to a method for a more general type (probably LinPredModel).

BTW, I don't think this method is correct as LinPredModel includes GeneralizedLinearModel. It should be restricted to LinearModel, and moved to lm.jl.

@jerlich
Copy link

jerlich commented Aug 12, 2025

what's the status of this PR? Can it get a bit of love?

function formula(obj::LinPredModel)
function residuals(model::LinPredModel; type=:deviance)
type in _RESIDUAL_TYPES ||
throw(ArgumentError("Unsupported type `$(type)``; supported types are" *
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
throw(ArgumentError("Unsupported type `$(type)``; supported types are" *
throw(ArgumentError("Unsupported type `$(type)`; supported types are " *

(Could be fixed in the GLM method too BTW.)

residuals(obj::LinPredModel) = residuals(obj.rr)

function formula(obj::LinPredModel)
function residuals(model::LinPredModel; type=:deviance)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That docstring is attached only to the method for GeneralizedLinearModel. It should be attached to a method for a more general type (probably LinPredModel).

BTW, I don't think this method is correct as LinPredModel includes GeneralizedLinearModel. It should be restricted to LinearModel, and moved to lm.jl.

@ViralBShah ViralBShah mentioned this pull request Dec 23, 2025
3 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants