pbreheny / visreg

Visualization of regression functions
http://pbreheny.github.io/visreg/
61 stars 18 forks source link

Code breaks now when obtaining data from my GAM model #13

Closed roxannebeauclair closed 8 years ago

roxannebeauclair commented 8 years ago

I recently updated to visreg 2.2-1 and now all of a sudden some of my code breaks when using visreg. When I try to obtain a dataset from my gam model object, I get this error:

Error in model.frame.default(formula = hivever ~ s(admean) + s(age0) + : invalid type (list) for variable 's(admean)'

As I said, my code used to work without producing any errors. Here is my code (although it isn't reproducible):

m1 <- gam(hivever ~ s(admean) + s(age0) + totalpartners, data=women, family=binomial)

v1mean <- visreg(m1, xvar = "admean", type = "contrast", scale = "response")

pbreheny commented 8 years ago

Interesting...in the new version, I made some changes to allow visreg to work with formulas that contain dots, such as

y ~ x + .

But apparently this broke the compatibility with mgcv (and some other packages, actually).

Anyway, this is fixed now. If you update the package with

install_github("pbreheny/visreg")

visreg should work with GAMs again. I'll try to get a new version on CRAN by next week.

Thank you very much for bringing this to my attention!

roxannebeauclair commented 8 years ago

Thank you! It works beautifully now.

On Tue, Jan 19, 2016 at 6:45 PM, Patrick Breheny notifications@github.com wrote:

Closed #13 https://github.com/pbreheny/visreg/issues/13.

— Reply to this email directly or view it on GitHub https://github.com/pbreheny/visreg/issues/13#event-519312073.

Roxanne Beauclair, PhD Candidate, MA, MPH International Centre for Reproductive Health (ICRH) Ghent University, Belgium www.icrh.org

The South African Department of Science and Technology / National Research Foundation (DST/NRF) Centre of Excellence in Epidemiological Modelling and Analysis (SACEMA) Stellenbosch University, South Africa www.sacema.com

Tel: +27 21 808 9236 (work) Cell: +27 82 212 1621 (cell)