### Install Development Version of tcplfit2 Source: https://github.com/usepa/comptox-toxcast-tcplfit2/blob/dev/README.md To install the current development version of the tcplfit2 package, use the devtools::install_github function. This command fetches the latest code directly from the GitHub repository. ```r devtools::install_github("USEPA/CompTox-ToxCast-tcplfit2") ``` -------------------------------- ### Run Concentration-Response Models for Multiple Samples Source: https://github.com/usepa/comptox-toxcast-tcplfit2/blob/dev/tcplfit2-vignette.md This R code snippet demonstrates how to load assay data, preprocess it, and run a series of concentration-response models for selected samples. It includes determining background variation and plotting the results for each sample. ```r # read in the data file <- "data/mc3.RData" load(file=file) print(dim(mc3)) # set up a 3 x 2 grid for the plots oldpar <- par(no.readonly = TRUE) on.exit(par(oldpar)) par(mfrow=c(3,2),mar=c(4,4,2,2)) # determine the background variation temp <- mc3[mc3$logc<= -2,"resp"] bmad <- mad(temp) onesd <- sd(temp) cutoff <- 3*bmad # select six samples. Note that there may be more than one sample processed for a given chemical spid.list <- unique(mc3$spid) spid.list <- spid.list[1:6] for(spid in spid.list) { # select the data for just this sample temp <- mc3[is.element(mc3$spid,spid),] # The data file has stored concentration in log10 form, so fix that conc <- 10**temp$logc resp <- temp$resp # pull out all of the chemical identifiers and the name of the assay dtxsid <- temp[1,"dtxsid"] casrn <- temp[1,"casrn"] name <- temp[1,"name"] assay <- temp[1,"assay"] # create the row object row <- list(conc = conc, resp = resp, bmed = 0, cutoff = cutoff, onesd = onesd,assay=assay,dtxsid=dtxsid,casrn=casrn,name=name) # run the concentration-response modeling for a single sample res <- concRespCore(row,fitmodels = c("cnst", "hill", "gnls", "poly1", "poly2", "pow", "exp2", "exp3", "exp4", "exp5"),conthits = T, aicc = F,bidirectional=F) # plot the results concRespPlot(res$summary,ymin=-10,ymax=100) } ``` -------------------------------- ### Load tcplfit2 Package Source: https://github.com/usepa/comptox-toxcast-tcplfit2/blob/dev/tcplfit2-vignette.md Loads the tcplfit2 package for use in subsequent operations. ```r library(tcplfit2) ``` -------------------------------- ### Run Single Concentration-Response Calculation Source: https://github.com/usepa/comptox-toxcast-tcplfit2/blob/dev/tcplfit2-vignette.md Performs a single concentration-response calculation using the concRespCore function with specified parameters and models. The output includes a summary of the winning model and detailed results for all run models. ```r conc <- list(.03,.1,.3,1,3,10,30,100) resp <- list(0,.2,.1,.4,.7,.9,.6, 1.2) row <- list(conc = conc, resp = resp, bmed = 0, cutoff = 1, onesd = .5) res <- concRespCore(row,fitmodels = c("cnst", "hill", "gnls", "poly1", "poly2", "pow", "exp2", "exp3", "exp4", "exp5"),conthits = T, do.plot=T) res$summary ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.