fitmix.r2: For finite mixture of univariate Gaussian densities, computes...

Description Usage Arguments Value Author(s) Examples

Description

Computes the true R-squared if the mixture labels were known without error. Currently only works if all components have the same variance.

Usage

1
fitmix.r2(p, mu, sigma)

Arguments

p

Real vector of mixture proportions.

mu

Real vector of mixture component means.

sigma

Mixture component standard deviation, same for all components.

Value

The R-squared value for a (hypothetical) regression of data values onto mixture label, as a k level factor.

Author(s)

Toby Johnson Toby.x.Johnson@gsk.com

Examples

1
2
3
4
5
6
7
xx <- fitmix.simulate(100, c(0.49, 0.42, 0.09), c(0, 1, 2), c(.3, .3, .3))

## additive model, common variance, Hardy--Weinberg
fit.a <- fitmix(xx, 3, maxit = 10, restarts = 3,
                sigma.common = TRUE, p.binomial = TRUE, mu.additive = TRUE)
fitmix.plot(xx, fit.a$p, fit.a$mu, fit.a$sigma)
fitmix.r2(fit.a$p, fit.a$mu, unique(fit.a$sigma))

gtx documentation built on May 2, 2019, 5:08 a.m.