Comments (6)
I had a look at the code and the difference is this line:
Line 391 in d40d33d
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.
Also @maxdrohde thanks for the well structured issue with reprex and everything 10/10! 🎉
from simstudy.
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.
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.
@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.
@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)
- Should we combine genCorData and genCorGen?
- Change assertPositiveDefinite to assertPositiveSemiDefinite
- Release simstudy 0.6.0 HOT 2
- add double-dot functionality for defSurv
- Generate unbalanced cluster sizes HOT 1
- Modify survParamPlot to allow x-axis limits HOT 1
- double dot notation not working properly in genSurv HOT 1
- Release simstudy 0.7.0
- Generating large data sets is slower than I thought HOT 8
- addCorGen can be quite slow
- genCorGen with varying cluster sizes
- Add flexibility to function logisticCoefs
- nonrandom distribution returns a single value when repeated values are expected HOT 1
- Release simstudy 0.7.1
- External variable in `logisticCoefs` call not recognized when inside function call HOT 9
- Create a longitudinal dataset is not just counting integers but reflects actual time points HOT 4
- genBlockMat() function doesn't exist HOT 2
- Release simstudy 0.8.0 HOT 1
- Use formula to simulate categorical variable HOT 9
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from simstudy.