Pmetrics icon indicating copy to clipboard operation
Pmetrics copied to clipboard

Minor bug in PTA analysis

Open CDarlow opened this issue 2 months ago • 2 comments

I was recently running a simulation with a model, with just one subject in the simulation data file, and tried to do a PTA analysis, only for the code to return the following code and error:

NeoFloSimPTA<-NeoFlo$sim(data=NeoFloData,nsim=1000,limits=NA) NeoFloPTA<-NeoFloSimPTA$pta(targets=c(0.125,0.25,0.5,1,2,4,8,16,32),target.type="time", success=0.4,start=0, end=24, outeq=1)

Error in simdata[[1]] : wrong arguments for subsetting an environment

The issue is the PM_Sim environment creates a list of entries [1], [2] etc. in the environment folder amt when you simulate with multiple individuals, which are called by the pta function. However, if you simulate with just one individual, the simulation data is just within amt (without being in a [1] folder) and therefore cannot be called by the pta function.

I've worked around it by having a dummy second individual, but just reporting to highlight the bug.

CDarlow avatar Nov 19 '25 21:11 CDarlow

Thank you for reporting this - it should pretty straightforward to fix. We will be working on it along with the next release of Pmetrics.

mhovd avatar Nov 20 '25 07:11 mhovd

Would you be interested in sharing the simulation with me so I can test it in the upcoming version? We’ve completely revamped the PTA function to allow for multiple simultaneous targets as well as defining success below a target in addition to the existing above target success.

Using your names, you can use the save method as NeoFloSimPTA$save(). Then send me the resulting “PMsim.rds” file.

mnneely avatar Nov 20 '25 14:11 mnneely