Comments (7)
Yes - that is indeed a bug. If you want a quick workaround while that is fixed, you can do this:
ydef <- defData(varname = "randomEffect",
dist = "normal", formula = 0, variance = sqrt(10))
ydef <- defData(ydef, varname = "T",
dist = "trtAssign", formula = "1;1")
genData(6, ydef)
#> id randomEffect T
#> 1: 1 2.6744327 0
#> 2: 2 0.3138995 1
#> 3: 3 -0.9968553 0
#> 4: 4 0.2780552 1
#> 5: 5 -1.3009989 1
#> 6: 6 1.5663468 0
But great catch, I will certainly fix that bug.
from simstudy.
@hebaalhosainyTU This has been fixed in the current development version. Thanks again.
from simstudy.
After applying the trtAssign function, the values in randomEffect column changed and not anymore normally distributed.
from simstudy.
Hello @hebaalhosainyTU thanks for the report. Next time please consider using reprex (see below) as it makes it easier to reproduce issues.
@kgoldfeld Reprex below is rendered with cran version of simstudy and indeed looks problematic. I haven't had time to look deeoer into it though.
library(simstudy)
ydef <- defData(varname = "randomEffect", dist = "normal", formula = 0, variance = sqrt(3))
indData <- genData(24, ydef)
head(indData)
#> id randomEffect
#> 1: 1 2.9851502
#> 2: 2 0.9825252
#> 3: 3 -0.3632496
#> 4: 4 -0.3291816
#> 5: 5 0.4210097
#> 6: 6 1.5862488
indData <- trtAssign(indData, nTrt = 2, balanced = TRUE, grpName = "T")
head(indData)
#> id randomEffect T
#> 1: 1 2 1
#> 2: 2 0 1
#> 3: 3 0 1
#> 4: 4 0 1
#> 5: 5 0 1
#> 6: 6 1 0
Created on 2022-09-28 with reprex v2.0.2
from simstudy.
Running the code a few times shows that the randomEffect
col is rounded to 0 decimal places...
from simstudy.
https://github.com/kgoldfeld/simstudy/blob/main/R/group_data.R#L401-L403
Converts ALL columns to integer
from simstudy.
@assignUser It is really strange how those lines of code got in there - must have been added to facilitate testing. And yet, testing did not pick that up. It is particularly odd since the output from trtAssign
(really trtObserve
) is already integer. Not sure why it would have seemed like a good idea to convert even the treament variable to integer. I will remove the offending code.
from simstudy.
Related Issues (20)
- Release simstudy 0.5.1
- addCorGen is very inflexible - needs to be updated HOT 1
- Package pbv not found R CMD CHECK on several servers (related to genCorGen) HOT 1
- Allow genCorMat to generate a list of covariance matrices of different sizes ... HOT 1
- genCorGen can accomodate Normal distribution, but gives an error HOT 1
- 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
- Treatment values change when `ratio` argument is used? HOT 6
- nonrandom distribution returns a single value when repeated values are expected HOT 1
- Release simstudy 0.7.1
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.