Coder Social home page Coder Social logo

autoreg's People

Contributors

cardiomoon avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

autoreg's Issues

autoReg.glm not working when sample weights incorporated

Hi,
the autoReg function throws an error when the model is of the form:
glm(y ~ x1 + x2, weights = w, data=data, family='binomial')

The error being:

Error in map():
โ„น In index: 1.
Caused by error in model.frame.default():
! 'data' must be a data.frame, environment, or list
Run rlang::last_trace() to see where the error occurred.

  1. After digging deeper, the issue seems to stem from the function: fit2model, about line 77
    dataname = as.character(fit$call)[length(as.character(fit$call))]
    What happens is that, if you incorporate sample weights into the model, it appears as the last object in fit$call, and therefore dataname gets a vector of weights instead of the dataset used in fitting the model.

  2. Another the issue seems to be coming from fit2list, as it fits a lm/glm model in about line 18, 21-22, with only, formula, data and family being parameters, there should probably be a ... so that extra parameters e.g weights are incorporated.

Factor variables not displaying in LM model results correctly when reference level is changed

Thank you for the package. Packages creating publication ready tables are always welcome. I found that, at least for plain linear models, specifying new contrasts does not produce the final table as I expected. See the following for an example of what happens:

`library(autoReg)
data("mtcars")
fit=lm(mpg ~ cyl,
data=mtcars)
autoReg(fit,final=TRUE)

mtcars$cyl.f <- factor(mtcars$cyl)
fit = lm(mpg ~ cyl.f,
data=mtcars)
autoReg(fit,final=TRUE)

contrasts(mtcars$cyl.f) <- contr.treatment(3, base = 3)
fit = lm(mpg ~ cyl.f,
data=mtcars)
autoReg(fit,final=TRUE)`

Admittedly, I do not know how to read R code well enough to look at the underlying functions to know what is going on, or how it might be fixed.

Thanks again.

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.