Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

implement more trending_model_fit accessors #14

Open
TimTaylor opened this issue Feb 22, 2021 · 1 comment
Open

implement more trending_model_fit accessors #14

TimTaylor opened this issue Feb 22, 2021 · 1 comment

Comments

@TimTaylor
Copy link
Contributor

No description provided.

@thibautjombart
Copy link
Contributor

library(trending)
x = rnorm(100, mean = 0)
y = rpois(n = 100, lambda = exp(1.5 + 0.5*x))
dat <- data.frame(x = x, y = y)

poisson_model <- glm_model(y ~ x , family = "poisson")

get_formula(poisson_model) # works
#> y ~ x
get_response(poisson_model) # works
#> [1] "y"

f <- fit(poisson_model, dat)

get_model(f) # works
#> 
#> Call:  glm(formula = y ~ x, family = "poisson", data = data)
#> 
#> Coefficients:
#> (Intercept)            x  
#>      1.5167       0.5064  
#> 
#> Degrees of Freedom: 99 Total (i.e. Null);  98 Residual
#> Null Deviance:       237.5 
#> Residual Deviance: 104.7     AIC: 426.2
get_formula(f) # missing
#> Error in UseMethod("get_formula", x): no applicable method for 'get_formula' applied to an object of class "c('trending_model_fit', 'list')"
get_response(f) # missing
#> Error in UseMethod("get_response", x): no applicable method for 'get_response' applied to an object of class "c('trending_model_fit', 'list')"

Created on 2021-02-22 by the reprex package (v1.0.0)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants