parsetgen: Functions for DBSolveOptimum to generate parameters and...

View source: R/parsetgen.R

parsetgenR Documentation

Functions for DBSolveOptimum to generate parameters and conditions using multivariate normal distribution

Description

The function parsetgen generates random dataset.

The function parsetgen.cond add to the dataset from parsetgen conditions columns and nos column

Usage

parsetgen(cov, mu, transform="", samples=1024)
parsetgen.cond(parset, cond=data.frame(), max.samples=nrow(parset), uniq.nos=FALSE)

Arguments

cov

covariance matrix with dimension nxn and whose element in i,j positions is the covariance between the i and j elements.

mu

named vector length of n with named parameters and their expectations

transform

character vector containing the distribution for each parameter. It can be "" for normal distribution and "log" for log-normal distribution

samples

number of the samples that we want to get in the ouput dataset (1024 as default)

parset

output data.frame from parsetgen function or users data.frame

cond

conditional data.frame. If empty, the result of parsetgen.cond is input data.frame with nos column

max.samples

number of resulted samples for each condition. If nrow(parset)<max.samples, that provide an error. If nrow(parset)>max.samples, that cuts the data frame by number of samples

uniq.nos

number of unique parameter set. If FALSE, then nos will be with repeating, and if TRUE - nos will have unique number.

Value

The output is data.frame with the columns named as names in your expect vector, and for parsetgen.cond it will be data.frame with the "nos" column, and names(parset) columns and names(cond) column

Note

parsetgen function does not provide nos column. If you need one, use out<-parsetgen() followed by final<-parstgen.cond(out).

See Also

rmvnorm

Examples

### create parameter set for Monte-Carlo simulation using covariance matrix (example4)
example4_parset<-parsetgen(example4_stat$muCov, example4_stat$mu, example4_stat$transform)
example4_parset.cond<-parsetgen.cond(
  example4_parset,
  cond=data.frame(Dose=c(1,5,10,1,5,10), T=c(12,12,12,24,24,24))
  )
write.delim(example4_parset.cond, "example4_parset.cond.txt")

  
### create parameter set for Monte-Carlo simulation using parameter set based on bootstrapping(example4)
example4_parset_bs.cond<-parsetgen.cond(
  example4_parset_bs[,c(1,2,3,4,6)],
  cond=data.frame(Dose=c(1,5,10,1,5,10), T=c(12,12,12,24,24,24))
  )
write.delim(example4_parset_bs.cond, "example4_parset_bs.cond.txt")

### Making some parameter set with three expectation and cov as vector
  expect<-c(kcat=0.5, Vd=23.4, Km=12.4) #making expect vector
  cov<-c(23.5, 37.9, 23.5) #making vector for coviance matrix
  transform<-c("log", "", "log") #the transform vector with distributions
  output<-parsetgen(cov, expect, transform)
  
  #Making some dataset,with three expectation and cov as vector
  expect<-c(kcat=0.5,Vd=23.4,Km=12.4) #making expect vector
  cov<-matrix(c(23.5,0,1, 0,37.9,0, 1,0,23.5), ncol=3) #coviance matrix
  transform<-c("log","","log") #the transform vector with distributions
  output<-parsetgen(cov, expect, transform)
  
  #Using the parsetgen.cond function. Suppose we have output from parsetgen function
  cond<-data.frame(cond1=c(1,2.5,1), cond2=c(0,0,1), cond3=c(0,0,0))
  output1<-parsetgen.cond(output, cond=cond, max.samples=1024,uniq.nos=FALSE)

insysbio/dbs-package documentation built on Aug. 4, 2022, 2:11 p.m.