Closed bblonder closed 3 years ago
Nevermind - it looks like an issue arises when one of the model predictors is an ordered factor, but not an unordered factor - that solves my particular problem well enough as I can accept this limitation. Perhaps worth looking into in the more general case later on though!
I don't understand. First, the code you provide above works just fine for me:
library(visreg)
library(nlme)
fm1 <- gls(follicles ~ sin(2*pi*Time) + cos(2*pi*Time), Ovary, correlation = corAR1(form = ~ 1 | Mare))
visreg(fm1, 'Time')
Second, in what sense does visreg
not work with ordered factors? This also works fine for me:
airquality$Heat <- ordered(cut(airquality$Temp, 3, labels=c("Cool","Mild","Hot")))
fit <- lm(Ozone ~ Solar.R + Wind + Heat, data=airquality)
visreg(fit, 'Heat')
Looks like I had a conflict with some other loaded packages - I tried a clean session and all is now well. I think this can be closed - sorry for the hassle.
Benjamin Blonder
On Wed, Feb 3, 2021 at 11:46 AM Patrick Breheny notifications@github.com wrote:
I don't understand. First, the code you provide above works just fine for me:
library(visreg) library(nlme)fm1 <- gls(follicles ~ sin(2piTime) + cos(2piTime), Ovary, correlation = corAR1(form = ~ 1 | Mare)) visreg(fm1, 'Time')
Second, in what sense does visreg not work with ordered factors? This also works fine for me:
airquality$Heat <- ordered(cut(airquality$Temp, 3, labels=c("Cool","Mild","Hot")))fit <- lm(Ozone ~ Solar.R + Wind + Heat, data=airquality) visreg(fit, 'Heat')
— You are receiving this because you modified the open/close state. Reply to this email directly, view it on GitHub https://github.com/pbreheny/visreg/issues/88#issuecomment-772774784, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAE66P4O2LA5RZZ6OG2GVM3S5GRYZANCNFSM4W74T64Q .
Will it be possible to get visreg to work with gls regressions? Here is an example that fails (pulled from the ?gls example).
library(nlme) fm1 <- gls(follicles ~ sin(2piTime) + cos(2piTime), Ovary, correlation = corAR1(form = ~ 1 | Mare)) visreg(fm1)
My actual use would be a phylogenetic multiple regression with a different correlation argument, see replicable example at: https://lukejharmon.github.io/ilhabela/instruction/2015/07/03/PGLS/