snm.diagnosticPlot: Produce Diagnostic Plots For SNM Algorithm

Description Usage Arguments Author(s) Examples

Description

This function produces plots useful for diagnosing problems with an assumed study-specific model.

Usage

1
snm.diagnostic.plot(obs.fit, obs.stat, snm.obj, basisSplineFunction, n.iter)

Arguments

obs.fit

List of estimated coefficient matrices and residuals from full and reduced models

obs.stat

List of statistic obtained from model fit.

snm.obj

An object of class snm.

basisSplineFunction

Basis spline functions for intenisty-dependent functions

n.iter

Current iteration number

Author(s)

Brig Mecham <brig.mecham@sagebase.org>

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
##---- Should be DIRECTLY executable !! ----
##-- ==>  Define data, use random,
##--	or do  help(data=index)  for the standard data sets.

## The function is currently defined as
function (obs.fit,obs.stat,snm.obj,
          basisSplineFunction)
{
  par(mfrow=c(2,2))
  bds <- ifelse(snm.obj$bin.densities > 500, 500, snm.obj$bin.densities)
  plot(rowMeans(snm.obj$M.pooled),
       bds,ylim=c(0,500),
       xlab="Estimated RNA Concentration", ylab="Probes per bin", main="Null probes per bin")

  u <- fast.svd(obs.fit$res1,tol=0);
  plot(u$d^2 / sum(u$d^2), ylim=c(0,1),
       main="Latent Structure",
       xlab="Surrogate Variable",
       ylab="Percent Variance Explained")

  if(dim(snm.obj$dat)[1] > 5000) {
    th <- sample(dim(snm.obj$dat)[1], 5000)
  }else{
    th <- 1:dim(snm.obj$dat)[1]
  }

  oo <- order(snm.obj$M[th,1])
  plot(snm.obj$M[th[oo],1], snm.obj$array.fx[th[oo],1],
       type="l",lwd=3, ylim=range(snm.obj$array.fx[th[oo],]),
       xlab="Estimated RNA Concentration", ylab="Array Effect",main="Estimated Array Effects")
  sapply(2:dim(snm.obj$r.dat)[2],function(id) {
    oo <- order(snm.obj$M[th,id])
    points(snm.obj$M[th[oo],id], snm.obj$array.fx[th[oo],id],type="l",lwd=3)
  }) -> hmm

  hist(obs.stat$pval, xlab="P values",main="P value distribution");
  abline(v=sort(obs.stat$pval)[length(obs.stat$pval)*(1-snm.obj$pi0)],col="red")

  }

Sage-Bionetworks/snm documentation built on May 9, 2019, 12:14 p.m.