visreg for gls regressions?
bblonder opened this issue · 3 comments
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/
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')