CS代考计算机代写 Pharmacometrics CHLD0085: Assignment

Pharmacometrics CHLD0085: Assignment
Candidate number
Examplokacin is a new aminoglycoside antibiotic. It has been given at a dose of 1000 mg by intravenous bolus to 50 volunteers, followed by intensive PK sampling. The data are provided in the file examplokacin.csv.
Using the Rmarkdown template provided, answer the questions below to create a Word or PDF document containing your answers along with the commented R code within each R chunk. You must label your assignment with your candidate number rather than your name to facilitate anonymous marking.
1 Write a sentence about each of the 4 PK processes (ADME) from your reading about aminoglycoside PK (4 marks)
2 Read in the data and make a plot of the data, with lines con- necting data from each individual, appropriate axis labels and using a log scale for the y-axis (4 marks)
3 Undertake a non-compartmental analysis of the data, reporting the median, 2.5th, and 97.5th percentiles of Cmax, Elimination half-life, AUC(0−t), AUC(0−∞) (4 marks)
# CODE HINT: In lattice a log scale can be specified with:
# xyplot( …, scales=list(y = list(log = TRUE)))
# CODE HINT: an amended version of the function in Hands-on 1:
trap.rule <- function(x,y) sum(diff(x) * (y[-1] + y[-length(y)])) / 2 # Specify function to do NCA for each individual calc.nca <- function(ID){ ##### ##### Assumes the dataset is called df ##### out <- df[df$ID==ID,] # Calculate AUC(0-t) using trap.rule function auct <- trap.rule(out$TIME, out$DV) # Select last 3 rows for ke calc temp1 <- tail(out, n = 3) # linear regression for slope of log of DVs abc <- lm(log(temp1$DV) ~ temp1$TIME) slope <- summary(abc)[[4]][[2]] 1 ke <- -slope # Cmax cmax <- max(out$DV) # Tmax tmax <- out$TIME[out$DV==cmax] # AUC(0-inf) # first find AUC(t-inf) C_last <- tail(temp1$DV, 1) auct_inf <- C_last / ke auc0_inf <- auct + auct_inf data.frame(ID, cmax, tmax, ke, auct, auc0_inf) } 4 Using nlmixr() fit 1 and 2 compartment models and test addi- tive or proportional residual errors. Use the Objective Func- tion Value, plots of NPDE versus TIME and |IWRES| ver- sus IPRED to choose your preferred structural and statistical model. Make a VPC of your final model, and create a table of parameter estimates (8 marks) # CODE HINT 1: Remember you can save your run output with e.g.: # saveRDS(run1.lst, "run1.rds") # And read it back in with e.g.: # run1.lst <- readRDS("run1.rds") # This can save you running the model every time you compile your answer document # CODE HINT 2: Some useful functions for the plots you need: npde.gof <- function(run.fit){ # Set some options for colour, point type line styles/width # Have a go at changing these to see how the plots change cex.n <- 1 ; cex.pan <- 1 ; cex.pt <- 1 type.n <- "b"; pch.n <- 16 ; lty.n <- 2 lwd.n <- 0.5 ; col.n <- grey(0.6) # run.fit <- run1.lst goftab <- data.frame(run.fit) # NPDE vs TIME npde.time <- xyplot(NPDE ~ TIME, data = goftab, groups = ID, type = type.n, pch = pch.n, lty = lty.n, lwd = lwd.n, col = col.n, cex = cex.pt, ylab=list(label = "NPDE", cex = cex.n), xlab=list(label = "Time after first dose (h)", cex = cex.n), xlab.top=list(label = "NPDE vs time", cex = cex.n), panel=function(...){ panel.xyplot(...) # Add zero and +/-2 lines panel.abline(0, 0, lwd = 2) ; panel.abline(h = 2, 2 print(npde.time) } panel.abline(h = -2, lwd = 2, lty = 2) panel.loess(goftab$TIME, goftab$NPDE, lwd = 2, col = "red", span = 1)}) iwres.gof <- function(run.fit){ # Set some options for colour, point type line styles/width # Have a go at changing these to see how the plots change cex.n <- 1 ; cex.pan <- 1 ; cex.pt <- 1 type.n <- "b"; pch.n <- 16 ; lty.n <- 2 lwd.n <- 0.5 ; col.n <- grey(0.6) # run.fit <- run1.lst goftab <- data.frame(run.fit) iwres.ipred <- xyplot(abs(IWRES) ~ IPRED, data = goftab, groups = ID, type = type.n, print(iwres.ipred) } pch = pch.n, lty = lty.n, lwd = lwd.n, col = col.n, cex = cex.pt, ylab=list(label = "|IWRES|", cex = cex.n), xlab=list(label = "Individual prediction (mg/L)", cex = cex.n), xlab.top=list(label = "|IWRES| vs IPRED", cex = cex.n), panel=function(...){ panel.xyplot(...) panel.loess(goftab$IPRED, abs(goftab$IWRES), lwd = 2, col = "red", span = 1)}) lwd = 2, lty = 2) 3