calibrate: Calibration across data-sets

Description Usage Arguments Value Examples

View source: R/calibrate.R

Description

Given draws from the posterior, this function calibrates data-sets.

Usage

1
calibrate(x, reference.group = NULL)

Arguments

x

An MPK object

reference.group

Value

A list with three objects: Ycal is a matrix containing the calibrated data; calibration_distribution is an array with the posterior distribution of the shift for each observation; calibration_median is a matrix with the posterior median shift for each observation.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
n = c(250, 250)
p = 4

Y1 = rbind( matrix( rnorm( n[1]*p), ncol = p), matrix( rnorm(n[2]*p) + 3, ncol = p))
Y2 = rbind( matrix( rnorm( n[1]*p), ncol = p), matrix( rnorm(n[2]*p) + 4, ncol = p))
Y = rbind(Y1, Y2)
C = c( rep(1,sum(n)), rep(2,sum(n)))

ans = mpk(Y, C)
cal = calibrate(ans)
par(mfrow=c(1,2))
plot(Y, col = C)
plot(cal$Y_cal, col = C)

jacsor/MPK documentation built on May 18, 2019, 9:05 a.m.