Giter Site home page Giter Site logo

Comments (6)

assignUser avatar assignUser commented on June 26, 2024

I had a look at the code and the difference is this line:

formula <- .5
if we change this to be c(.5, .5) it produces the same out put as trtObserve uses length(formulas) to set ncat which is then used to generate the values.

That line takes advantage of the fact that trtObserve adds a 'remainder' column to the matrix that is used to generate the values but produces this inconsistent result. Unless @kgoldfeld has objections I would say it makes sense to apply the minor change and make the results (and the code) consistent.

from simstudy.

assignUser avatar assignUser commented on June 26, 2024

Also @maxdrohde thanks for the well structured issue with reprex and everything 10/10! 🎉

from simstudy.

kgoldfeld avatar kgoldfeld commented on June 26, 2024

I agree that the result is not ideal, and I agree that it should be changed. I do have concerns that it might impact some users who have learned to live with it.

As an aside, if you use trtAssign as a distribution in a dataDef, the results are more what you would expect:

d <- defData(varname = "tx", formula = "1;3", dist = "trtAssign")
genData(1000, d)[, table(tx)]
tx
  0   1 
250 750 
d <- defData(varname = "tx", formula = "1;2;3", dist = "trtAssign")
genData(1000, d)[, table(tx)]
tx
  1   2   3 
167 334 499 

from simstudy.

kgoldfeld avatar kgoldfeld commented on June 26, 2024

I just want to make clear what would be the ideal behavior. It seems to me that with two categories, the result should always be 0/1, and never 1/2. @maxdrohde Is that what you were thinking as well?

from simstudy.

maxdrohde avatar maxdrohde commented on June 26, 2024

@kgoldfeld Yes, just using 0/1 sounds good to me. My main concern was just that it wasn't consistent. Thanks for looking into this!

from simstudy.

kgoldfeld avatar kgoldfeld commented on June 26, 2024

@maxdrohde Just wanted to let you know that the behavior of trtAssign behavior is now consistent so that 0/1 is generated with 2 treatment arms, but 1/2/3/... is used with more than 2 arms. The changes are available in the development version here on github.

from simstudy.

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.