Giter Site home page Giter Site logo

Comments (3)

alexanderrobitzsch avatar alexanderrobitzsch commented on August 18, 2024

I agree that overwriting wgt__ produces an error. I just did not see an alternative simple method to get the lm formula evaluation running inside the function.

from miceadds.

b-johns avatar b-johns commented on August 18, 2024

I have been having the same issue as the original poster when calling lm.cluster and glm.cluster within a larger function. Is the best strategy for now to set wgt__ <- NULL just before calling the larger function, as he suggested? Or will this cause other problems that I'm not foreseeing?

from miceadds.

ahoundetoungan avatar ahoundetoungan commented on August 18, 2024

@b-johns , adding wgt__ <- NULL before calling the function is a good solution if you do not use weight in glm.cluster. In this case, weight argument in glm.cluster is NULL and corresponds to what has been created before calling the function. If you use weight in glm.cluster, the best way is to add wgt__ <<- weight before glm.cluster, where weight is the vector of weights plugged into the function glm.cluster. Here is an example.

f <- function(...){
....
wgt__ <<- wghts
mTP <- glm.cluster(formula = y ~ X, cluster = 'IDClass', weights = wghts, data = data)
....
}

The line wgt__ <<- wghtsP creates wgt__ in the global environment because of the assignment approach <<-. This makes sure that the weight wgt__ created is the one used in the function glm.cluster. If there are no weights, wgt__ <<- wghtsP can be replaced with wgt__ <<- NULL.

from miceadds.

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.