Coder Social home page Coder Social logo

clusterpower's People

Contributors

alexandria-sakrejda avatar jm3594 avatar joshua-nugent avatar katieleap avatar kenkleinman avatar nickreich avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

clusterpower's Issues

single-period studies

If n.periods=1 is specified, than throw warning if period.effect or period.var is specified.

Shiny app: new error created after installing nearPoints.

Warning: Error in data.frame: arguments imply differing number of rows: 216, 233
74: stop
73: data.frame
72: observeEventHandler [C:\Users\acbro0\Documents\Kleinman-computer\clusterPower\inst\shiny-examples\app/app.R#2325]
1: runApp

triggered on the next run after nearPoints is activated.

update nlme function call with better optimizer

In cps.ma.internal...

I had told ken and lexi earlier that the code for the 'varying sigma2_b and varying sigma' should be this, and it was implemented:
my.mod <- nlme::lme(y~as.factor(trt2), random=~1+as.factor(trt2)|clust2, weights=nlme::varIdent(form=~1|as.factor(trt2)), method="ML", control=nlme::lmeControl(opt='optim'))
BUT to converge more consistently, set the optimizer to Nelder-Mead. Should look something like:
my.mod <- nlme::lme(y~as.factor(trt2), random=~1+as.factor(trt2)|clust2, weights=nlme::varIdent(form=~1|as.factor(trt2)), method="ML", control = lmeControl(opt = "optim", optimMethod = "Nelder-Mead"))

gaussian glmer call

When running a power.sim.normal, we get this warning:
1: In glmer(y ~ trt + (1 | clust), data = dat, family = outcome.type, :
calling glmer() with family=gaussian (identity link) as a shortcut to lmer() is deprecated; please call lmer() directly

cps.normal: !is.integer() does not function properly during user input validation

When running the code using !is.integer() to ensure nsim, n, m, and difference are all whole numbers, function will properly run for first function call, but any subsequent calls of cps.normal will classify nsim, n, m, and difference as class: double and will result in error message. While not an issue in and of itself, after this point neither !is.integer() OR 'is.integer()` work; both come back FALSE.

I suspect this may be an issue specific to my machine.

The helper function is.wholenumber is created to address this issue, however using is.integer() would be preferred.

Renaming n and m globally across functions

The system of "n" and "m" is not working.

I suggest that all the functions use "nc" for number of clusters and "ns" for number of subjects throughout the package. Other proposals welcome.

I recognize that this is a PIA, but I think it will pay off for users and ourselves.

Short term to-dos

Change sigma_b to sigma_b_sq in Alex’s code
In cps.sw.count(), c.ntrt and c.trt say that they accept a scalar between 0-1, but that’s not what’s in the example (c.ntrt=3, c.trt=5),
For SW designs put in roxygen comments that we need to make explicit language to describe stepped wedge design. Clarify steps.
Give user access to glmcontrol in the … (but include in arguments) (can ask Josh for advice on optimizers)
Testthat test in 4c won’t run, but components run fine - try a different optimizer - still working on this
Suppress warnings
Fix progress bar/cluster computing issue (normal method has faulty time estimation)
For multi-arm simulation methods
Change output to have binary match normal, seed
Avg betas in default print method
Pairwise comparisons in output
Continue testthat tests
Check params/return objects in documentation
Include table1 as summary method -- recreate Alex’s/Jon’s print/summary methods, avg number of subjects in each arm, clusters in each arm
Option to include ICC output
Check means, residual error, cluster means are what they’re supposed to be.
Observed ICC for multi-arm trial- use Alex’s lmer_icc method (ANOVA?)

Mid-term to-dos

Add to man page:
Examples used in testing compared to NIH
Example using different methods
Testing:
Test across a range of powers for simulations
Change simulation number to 1000
(p1.base, p2.base, p1.followup, p2.followup, get rid of odds ratios for did.binary (revisit before I do this)
Have all the simulated methods stop if power is <0.5, by default
Checkout did.binary more closely bc it doesn’t seem to match NIH and PASS
Must be able to set the seed on all simulation methods.
Ask Josh about Laplace vs. numerical quadrature for simulated methods.
Cps.binary option for parallel computing?
Cps.binary (and others?) arguments appear in CAPS in the error messages but the actual arguments are in lower case.- Ken says this can be changed, helpful error messages.
Vignette
Equation for stepped wedge designs, more explanation
More explanation: multi-arm trial designs
Compare to CRTsize pkg, Pass11 in the vignette
IRGTTs where all subjects are treated in groups should be treated as CRTs for the purposes of power calculation, though most likely we need separate sigma/ICC per tx group. This should be noted in the man pages for the IRGTT functions and/or in a vignette for IRGTTs.

Restore "GEE" as an option in cps.ma.normal

I removed this option for now, I can put it back in later. Need to restore "method" to the arguments and the if/then statement that provides GEE as an alternative to glmm.

package is not building

** libs
llvm-g++-4.2 -arch x86_64 -I/Library/Frameworks/R.framework/Resources/include -DNDEBUG -I/usr/local/include -fPIC -mtune=core2 -g -O2 -c RcppExports.cpp -o RcppExports.o
RcppExports.cpp:4:18: error: Rcpp.h: No such file or directory
RcppExports.cpp:6: error: ‘Rcpp’ is not a namespace-name
RcppExports.cpp:6: error: expected namespace-name before ‘;’ token
RcppExports.cpp:9: error: ‘List’ does not name a type
RcppExports.cpp:10: error: ‘RcppExport’ does not name a type
make: *** [RcppExports.o] Error 1
ERROR: compilation failed for package ‘clusterPower’

  • removing ‘/Library/Frameworks/R.framework/Versions/3.0/Resources/library/clusterPower’

Exited with status 1.

Shiny: sw simulation functions throwing errors

Unhandled promise error: nclusters/steps must be a whole number. See documentation for steps parameter in '?clusterPower::cps.sw.binary'
Unhandled promise error: unused arguments (power = q$power, ntimes = q$ntimescpaswnormal, d = q$dcpaswnormal, ICC = q$ICCcpaswnormal, rho_c = q$rho_ccpaswnormal, rho_s = q$rho_scpaswnormal, vart = q$vartcpaswnormal)

cps.normal: Inherit Group1 variance parameters if only partial Group 2 variance parameters are specified

This is not a issue in the code; just something to be considered.

Presently, at least 2 variance parameters must be specified for Group 1 for cps.normal to run. If only 1 variance parameter for Group 2 is specified, the code currently throws an error, informing the user they must specify at least 2 variance parameters if they wish to specify them for Group 2. If no variance parameters are specified for Group 2, they are assumed equal to those of Group 1.

The proposed issue would have Group 2 inherit a variance parameter from Group 1 to cover the deficit, under the assumption that the inherited parameter is equal between Groups. It has not been discussed which parameter would be inherited from Group 1 if both are missing from Group 2 (e.g. ICC & sigma have been specified for Group 1, and sigma_b has been specified for Group 2).

examples throwing errors

b <- power.sim.binomial(n.sim=10, effect.size=log(.75), alpha=.05, n.clusters=20, n.periods=2,
                         cluster.size=50, btw.clust.var=.2, period.effect=logit(.2),
                         estimation.function=random.effect, verbose=TRUE, period.var=0)

gives the error

starting simulation :: 2015-05-19 22:06:08
Error in diag(vcov(object, use.hessian = use.hessian)) : 
  error in evaluating the argument 'x' in selecting a method for function 'diag': Error in calc.vcov.hess(h) : could not find function "forceSymmetric"

Same with

c <- power.sim.poisson(n.sim=10, effect.size=log(.75), alpha=.05, n.clusters=100, n.periods=2,
                        cluster.size=10, btw.clust.var=.4, period.effect=log(.2),
                       estimation.function=random.effect, verbose=TRUE, period.var=0, at.risk.params=10)

line widths in documentation files

  • checking Rd line widths ... NOTE
    Rd file ‘hayes.power.poisson.Rd’:
    \usage lines wider than 90 characters:
    hayes.power.poisson(n.clusters, period.effect, btw.clust.var, at.risk.params, cluster.size, effect.size, alpha=.05)
    \examples lines wider than 100 characters:
    hayes.power.poisson(n.clusters=36, period.effect=log(.015), btw.clust.var=0, at.risk.params=20, cluster.size=20, effect.size=log(.7))

These lines will be truncated in the PDF manual.

Please fix, and re-check with R-patched or R-devel.

remove glmer as shortcut to lmer

Warning in glmer(y ~ trt + (1 | clust), data = dat, family = outcome.type, :
calling glmer() with family=gaussian (identity link) as a shortcut to lmer() is deprecated; please call lmer() directly

Need an update to remove a letter from a function?

Shiny app: selecting cpa.sw.binary crashes the app

Warning: Error in <-: 'names' attribute [8] must be the same length as the vector [3]
65: updateArgs [C:\Users\acbro0\Documents\Kleinman-computer\clusterPower\inst\shiny-examples\app/app.R#1333]
61: reactive:args [C:\Users\acbro0\Documents\Kleinman-computer\clusterPower\inst\shiny-examples\app/app.R#2006]

cps.normal: pval.vector is of length nsim*2, should be length(nsim)

Actively troubleshooting this issue. When examining output, entries in pval.vector appear to be double entered (e.g. 0.432, 0.432, 0.005, 0.005, 0.018, 0.018, ...). This results artificially tighter confidence intervals as nsim increases, since SE = sqrt(p * (1 - p) / nsim) vs. SE = sqrt(p * (1 - p) / (nsim*2))

Note: Code must be modified for pval.vector to be output. This is not natively supported.

example duration

  • checking examples ... [18s/18s] OK
    Examples with CPU or elapsed time > 5s
    user system elapsed
    power.sim.normal 12.54 0.382 13.185

is rather more than the 'few seconds' of the CRAN policies and should be reduced.

Investigate object size of cps.sw output objects

When using cps.sw functions, if a user specifies all.sim.data == TRUE, the resulting output objects can quickly become prohibitively large (>500MB), especially on computers with low RAM. I attempted to resolve this issue by storing the simulated data sets as matrices instead of data frames. However the resulting list of matrices supplied to the user was still comparable in size to the list of data frames.

I think it may be beneficial to explicitly warn users in the Roxygen comments for all.sim.data in the event no viable solution is found. An alternative might be storing only the response values y and creating an ancillary function that can take as an input that vector as well as nsubjects, nclusters & steps to reconstruct the data.frames

Tune timing estimates "better"

cps.normal(), at least, generates an irritating number of estimates. I would guess that it need not generate more than one message every 10 seconds. Here is what I would propose:

  1. do ~10 simulations and estimate the time remaining
  2. if less than 5 second remain, do nothing
  3. if 5-50 seconds remain, print a single message stating the estimated remaining time
  4. if more than 50 seconds remain, I'm not 100% sure-- maybe interrupt the simulations after the estimated 50 second mark to re-assess, report remaining estimated time, repeat every minute thereafter?

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.