### Load mrgsolve library Source: https://mrgsolve.github.io Loads the mrgsolve library. Ensure mrgsolve is installed before running. ```r library(mrgsolve) ``` -------------------------------- ### Display model overview Source: https://mrgsolve.github.io Prints a summary of the loaded model, including its structure, parameters, and compartments. ```r mod ``` -------------------------------- ### Simulate with model and events Source: https://mrgsolve.github.io Performs a simulation using the model object and the event object. Sets the simulation end time and time step. `set.seed` is used for reproducibility. ```r set.seed(1234) out <- mod %>% ev(e) %>% mrgsim(end = 240, delta = 0.1) out ``` -------------------------------- ### Model source code Source: https://mrgsolve.github.io Displays the source code for the '1005' model, including PK parameters, error model, and capture variables. ```cpp [ PROB ] 1005 phase1 2 CMT like 1004 but diff. initial on V3 Run file.show(system.file("nonmem", "1005", "1005.ctl", package = "mrgsolve")) for equivalent NONMEM control stream. [ PKMODEL ] cmt = "GUT CENT PERIPH", depot = TRUE [ INPUT ] SEX = 0, WT = 70 [ NMXML ] project = system.file("nonmem", package = "mrgsolve") run = "@cppstem" [ PK ] double CL = THETA(1)*exp(ETA(1)) * pow(THETA(6),SEX) * pow(WT/70.0,THETA(7)); double V2 = THETA(2)*exp(ETA(2)); double KA = THETA(3)*exp(ETA(3)); double Q = THETA(4); double V3 = THETA(5); double S2 = V2; [ ERROR ] double F = CENT/S2; double Y = F*(1+EPS(1)) + EPS(2); double IPRED = F; [ CAPTURE ] CL Q V2 V3 KA ETA(1) ETA(2) ETA(3) IPRED ``` -------------------------------- ### Display event object Source: https://mrgsolve.github.io Shows the structure and details of the created event object. ```r e ``` -------------------------------- ### Create an event object Source: https://mrgsolve.github.io Defines an event object for simulation, specifying dose amount, interval, and number of additional doses. The %>% operator is used for piping. ```r e <- ev(amt = 1000, ii = 24, addl = 3) %>% ev_rep(1:10) ``` -------------------------------- ### Load a pre-coded model Source: https://mrgsolve.github.io Creates a model object using a pre-coded model from the mrgsolve library. The model ID '1005' is used here. ```r mod <- modlib("1005") ``` -------------------------------- ### Plot simulation results Source: https://mrgsolve.github.io Generates a plot of the simulated data, showing the relationship between 'IPRED' and 'time'. ```r plot(out, IPRED ~ time) ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.