npsim: Simulate data for the normal-Poisson mixture model

View source: R/npsim.R

npsimR Documentation

Simulate data for the normal-Poisson mixture model

Description

Simulate data for a single plate using the normal-Poisson mixture model.

Usage

npsim(ests, n = c(24, 24, 24, 22))

Arguments

ests

Parameter values as a vector for the form (\lambda_1,...,\lambda_n), a, b, \sigma

n

Lengths of the \lambda groups

Value

k

The simulated numbers of responding cells per well, useful for comparison with those estimated from npem.em().

y

The simulated transformed scintillation counts, to be used as input for npem.em().

Author(s)

Karl W Broman, broman@wisc.edu

References

Broman et al. (1996) Estimation of antigen-responsive T cell frequencies in PBMC from human subjects. J Immunol Meth 198:119-132

See Also

npem.em()

Examples

  ests <- c(0.5,1.5,2.5,5,15,5)
  n <- c(24,24,22)
  dat <- npsim(ests,n)
  out <- npem.em(dat$y,ests=ests,n=n)
  jitter <- runif(length(dat$k),-0.1,0.1)
  plot(dat$k + jitter, out$k, xlab="True no. cells",
       ylab="Estimated no. cells", lwd=2)
  plot(dat$y,out$k,type="n",xlab="Response",ylab="Estimated no. cells")
  for(i in unique(dat$k))
    points(dat$y[dat$k==i],out$k[dat$k==i],col=i+1,lwd=2)


kbroman/npem documentation built on May 17, 2023, 11:52 p.m.