mlcollyer / RRPP

RRPP: An R package for fitting linear models to high-dimensional data using residual randomization
https://mlcollyer.github.io/RRPP/
4 stars 1 forks source link

coef() function returns NULL when using gls estimation #4

Closed jjustison closed 3 years ago

jjustison commented 3 years ago

Not sure if this is intended or not but the coef() function returns NULL for some lm.rrpp objects. I think this has to do with using a Cov argument and using GLS for estimation. For example:

data("PlethMorph")
fitOLS <- lm.rrpp(TailLength ~ SVL, data = PlethMorph, 
                  print.progress = FALSE, iter = 999)
fitGLS <- lm.rrpp(TailLength ~ SVL, data = PlethMorph, Cov = PlethMorph$PhyCov, 
                  print.progress = FALSE, iter = 999)

coef(fitOLS) ##Returns coefficients as expected
coef(fitGLS) ##Returns NULL

I think this has to do with how the estimates are saved. The OLS approach saves the coefficients in fitOLS$LM$coefficients while the GLS approach saves the coefficients under fitGLS$LM$gls.coefficients

mlcollyer commented 3 years ago

Hello,

Thanks for catching this! Originally, we $LM$coefficients, regardless of whether the estimation was OLS or GLS, but updated the function to remind users that the coefficients were estimated via GLS. It looks like we forgot to extend this to the coef.lm.rrpp function. I will fix it soon. In the interim, if you choose test = TRUE, the print.coef.lm.rrpp function will provide the coefficients (along with test statistics).

Cheers! Mike

On Aug 23, 2021, at 2:14 PM, jjustison @.***> wrote:

Not sure if this is intended or not but the coef() function returns NULL for some lm.rrpp objects. I think this has to do with using a Cov argument and using GLS for estimation. For example:

data("PlethMorph") fitOLS <- lm.rrpp(TailLength ~ SVL, data = PlethMorph, print.progress = FALSE, iter = 999) fitGLS <- lm.rrpp(TailLength ~ SVL, data = PlethMorph, Cov = PlethMorph$PhyCov, print.progress = FALSE, iter = 999)

coef(fitOLS) ##Returns coefficients as expected coef(fitGLS) ##Returns NULL I think this has to do with how the estimates are saved. The OLS approach saves the coefficients in fitOLS$LM$coefficients while the GLS approach saves the coefficients under fitGLS$LM$gls.coefficients

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/mlcollyer/RRPP/issues/4, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABUNU4QRMRQIMFAYR3GPBXLT6KFZNANCNFSM5CVDVA2Q. Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&utm_campaign=notification-email.

mlcollyer commented 3 years ago

This is fixed now!