Learn R Programming

RJaCGH (version 1.1.1)

normal.HMM.likelihood.NH.C: Likelihood for non-homogeneous hidden Markov model

Description

This function returns the log-likelihood for RJaCGH model, a hidden Markov model with normal distributed emissions and a non-homogeneous transition matrix as computed by Q.NH.

Usage

normal.HMM.likelihood.NH.C(y, x, mu, sigma.2, beta, stat = NULL,
q=-beta)

Arguments

y
Log Ratios observed
x
Vector of distances between genes
mu
Vector of means for the hidden states
sigma.2
Vector of variances for the hidden states
beta
beta in transition matrix
stat
Vector of initial probabilities. If NULL, a uniforma distribution is assumed.
q
q parameter in transition matrix. In RJaCGH model, q=-beta

Value

  • It returns a list with the same components passed plus:
  • loglikLog-likelihood

Details

This function is just an interface for the C routine to compute log-likelihood in RJaCGH model.

References

Oscar M. Rueda and Ramon Diaz Uriarte. A flexible, accurate and extensible statistical method for detecting genomic copy-number changes. http://biostats.bepress.com/cobra/ps/art9/. {http://biostats.bepress.com/cobra/ps/art9/}.

Examples

Run this code
## create data
y <- c(rnorm(100, 0, 1), rnorm(50, 3, 1), rnorm(20, -3, 1),
rnorm(60, 0, 1))
x <- sample(1:1000, 229, replace=FALSE)
x <- x/max(x)
Chrom <- rep(1:23, rep(10, 23))
## same model for all genome
loglik <- 0
for (i in 1:23) {
loglik <- loglik + normal.HMM.likelihood.NH.C(y=y, x =x, mu=c(-3, 0, 3),
sigma.2=c(1,1,1), beta=matrix(c(0, 1, 1, 1, 0, 1, 1, 1, 0), 3))$loglik
}
loglik

Run the code above in your browser using DataLab