예제 #1
0
bool estimable(mat rcDesign, int v, int model, mat linkM, mat C, mat Z, int verbose) {
    mat Xr, X, XX, XXXX, C2;
    Xr = rcdMatrix(rcDesign, v, model);
    X = Xr * linkM;
    X = join_rows(X, Z);
    XX = trans(X) * X;
    XXXX = pinv(XX) * XX;
    C2 = join_rows(C, zeros<mat>(C.n_rows, Z.n_cols));
    X = abs(C2 * XXXX - C2);
    if (verbose>2) {
        rcDesign.print(Rcout, "rcDesign:");
        Xr.print(Rcout, "Xr:");
        XXXX.print(Rcout, "XXXX:");
        X.print(Rcout, "X:");
    }
    double estCriterion = X.max(); // Criterion to test whether contrasts are estimable - see Theorem \ref{thr:estimable} of vignette.
    if (verbose>2) {
        Rprintf("The estimability criterion is: %f.\n", estCriterion); 
    }
    return(estCriterion < 0.0000001);
}