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

Should GCV change to accommodate GLM framework? #33

Open
hendersontrent opened this issue Jul 16, 2023 · 1 comment · May be fixed by #36
Open

Should GCV change to accommodate GLM framework? #33

hendersontrent opened this issue Jul 16, 2023 · 1 comment · May be fixed by #36
Labels
bug Something isn't working statistics

Comments

@hendersontrent
Copy link
Owner

Currently, the code is as per the below, but should we really be using RSS for say a Poisson problem?

function GCV(param::AbstractVector, Basis::BSplineBasis{Vector{Float64}}, x::AbstractVector, y::AbstractVector)
n = length(Basis.breakpoints)
Xp, yp = PenaltyMatrix(Basis, param[1], x, y)
β = coef(lm(Xp,yp))
H = Xpinv(Xp'Xp)Xp' # Hat matrix
trF = sum(diag(H)[1:n])
y_hat = Xp
β
rss = sum((yp-y_hat)[1:n].^2) # Residual sums of squares
gcv = n*rss/(n-trF)^2
return gcv
end

@hendersontrent hendersontrent added bug Something isn't working statistics labels Jul 16, 2023
@yahrMason
Copy link

I think the GCV function can stay, but I agree it is necessary to add other other scoring functions to fit non-normal GAMs. Wood outlines the methods of "penalized likelihood maximization" and penalized iterative least squares (PIRLS) on page 180 and 181 of his text. These both employ the GCV function already built, but have other steps involved. When I have some time I will take a look into converting his functions into Julia and replying here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working statistics
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants