Jump to content


Photo

Execute NLME automatically for a loop

nlme RsNLME pirana

  • Please log in to reply
1 reply to this topic

#1 linda

linda

    Member

  • Members
  • PipPip
  • 11 posts

Posted 12 January 2024 - 07:17 PM

Hi Everyone,

 

I am working on a project about determine sample size of a trial design. I need to keep enrolling different patients dataset and do pop PK fitting until criterion is fulfilled. Should I use RsNLME or Pirana? Could RsNLME can execute NLME automatically with a for loop? If yes, where could I get a case study or tutorial for RsNLME?

 

Thanks,

Linda 


  • RonaldAxon, Austingar, Donaldjet and 1 other like this

#2 cradhakr

cradhakr

    Advanced Member

  • Administrators
  • 78 posts

Posted 13 January 2024 - 11:31 PM

Hi Linda,

 

Yes, You can set up a loop for executing the model with RsNLME. However, this has to be done using R as we do not have this enabled through. We do not have a specific exaple to suite your need.

The below example was used for simulation using loop function. You could tweak the code accordingly to your needs. Hope this is useful to you.

 

 
for(i in 1:3){
 
  #i<-1
 
  # 2. Import Dataset ----
  # (we can modify this to set up simulation conditions)
  simdata<-read.csv(paste0(i,"/Data_testCertara.csv"))
 
 
  # 4. Create Model from PML and dataset using "textualmodel" function ----
  model <- textualmodel(modelName = paste(i),
                        data =  simdata,
                        mdl = paste0(i,"/model_testCertara.mdl"))
 
  # * 4.1 map model variables to data columns ----
 
  model <- colMapping(model, mappings = c(id = "X..id", A2S = "amt"))
 
 
  # 5. Fit Model ----
 
  # * 5.1 Define desired additional output table(s) ----
  TableCObs <- NlmeSimTableDef(name = "TableCObs.csv",
                                  timesList = seq(0,1000,10),
                                  variablesList = c("A2S","A3S","A4S","A5S","A6S"))
 
  TableParm <- NlmeSimTableDef(name = "TableParm.csv",
                                  timesList = c(0,0.0001,1,10,100,1000),
                                  variablesList = c("tvPappS", "tvCL3tot", "tvCL4tot",
                                                    "tvLIN_PappS","tvLIN_CL3tot","tvLIN_CL4tot",
                                                    "V2","V2_evs", "V4", "V4_evs", "Sample_VA",
                                                    "Sample_Vb", "tkev_a", "tkev"))
 
  # * 5.2 Fit setup ----
 
  # * * 5.2.1 Engine Settings (see: ?engineParams) ----
 
  EngineSettings <- engineParams(model = model,
                                 method = "Naive-Pooled",
                                 ODE = "Stiff")
 
 
 
  # * 5.3 Execute Fit ----
 
  modelfit <- fitmodel(model = model,
                     params = EngineSettings)
 
 
}
 
Thnaks
Mouli

  • Austingar likes this





Also tagged with one or more of these keywords: nlme, RsNLME, pirana

1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users