Coder Social home page Coder Social logo

Problems with offsets about ggeffects HOT 5 CLOSED

strengejacke avatar strengejacke commented on May 27, 2024
Problems with offsets

from ggeffects.

Comments (5)

strengejacke avatar strengejacke commented on May 27, 2024

Please provide a reproducible example.

from ggeffects.

strengejacke avatar strengejacke commented on May 27, 2024

should be fixed in strengejacke/sjstats@f8fd653, so you need to install the latest GitHub version of sjstats in order to solve this issue with ggeffects.

from ggeffects.

joehoover avatar joehoover commented on May 27, 2024

Hi,

This fix does not appear to be working for me. I installed the latest sjstats:

devtools::install_github("strengejacke/sjstats")

and then I installed the dev versions in sequence as you suggest in the sjstats readme:

devtools::install_github("strengejacke/sjlabelled")
devtools::install_github("strengejacke/sjmisc")
devtools::install_github("strengejacke/sjstats")
devtools::install_github("strengejacke/ggeffects")
devtools::install_github("strengejacke/sjPlot")

The new installations had no effect on the errors thrown by the following code:

d = data.frame(x1 = rnorm(100, 0, 1), 
                        x2 = rnorm(100, 0, 1), 
                        pop = rpois(100, 100)) 

d$y = rpois(100, exp(0 + d$x1*.3 + d$x2*-.4 + d$x1*d$x2*.5)) 
d$log_pop = log(d$pop)
m <- glm(y ~ x1*x2, offset=log(pop), data=d)
plot_model(m, type = "pred", terms = c("x1", "x2", "pop")) 

is.na() applied to non-(list or vector) of type 'NULL'Error in names(datlist) <- names(first) :
'names' attribute [3] must be the same length as the vector [2]

m <- glm(y ~ x1*x2, offset=log_pop, data=d)
plot_model(m, type = "pred", terms = c("x1", "x2", "log_pop")) 

ERROR: is.na() applied to non-(list or vector) of type 'NULL'Error in names(datlist) <- names(first) : 

'names' attribute [3] must be the same length as the vector [2]

names(sjstats::model_frame(m))`

returns a model frame where the offset term is called (offset).

from ggeffects.

strengejacke avatar strengejacke commented on May 27, 2024

This fix addressed a different issue, where the offset was part of the formula. Could you please file an issue at the sjstats-repo? https://github.com/strengejacke/sjstats/issues

from ggeffects.

joehoover avatar joehoover commented on May 27, 2024

Oh, perfect. I apologize for not noticing that. I will open the issue, but am glad that there is a workaround!

from ggeffects.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.