Qfun4subset: Constrained goodness-of-fit internal function

View source: R/cpaProgs.R

Qfun4subsetR Documentation

Constrained goodness-of-fit internal function

Description

An internal function used to assess the goodness-of-fit of a weighted mixture of reference profiles to a specified profile but with some proportions constrained to zero. There is a subset of varying parameters while other parameters are fixed at a particular value (typically zero).

Usage

Qfun4subset(
  pvec.vary,
  yy,
  gmat,
  methodQ = "sumsquares",
  ind.vary,
  ind.fixed,
  par.fixed
)

Arguments

pvec.vary

Vector of values between 0 and 1 summing to one (length = number of compartments)

yy

Specified profile

gmat

Matrix of reference profiles

methodQ

either 'sumsquares' (default) or 'sumabsvalue'

ind.vary

if not NULL, indexes of varying parameters

ind.fixed

indexes of fixed parameters; complement of ind.vary

par.fixed

values of fixed parameters; typically 0

Value

Value of goodness-of-fit function

Examples


# Suppose a profile consists of four fractions and there are three
#  reference compartment, designated A, B, and C

A <- c(1, 0, 0, 0)
B <- c(0, .5, 0.5,0)
C <- c(0, 0, 0, 1)
gmat<-cbind(A, B,C)
yy <- c(0.2, 0.15, 0.15, 0.5)
# Make vector for a candidate CPA value to be evaluated
pvec.vary <- c(0.3, 0.7)  # 30%  in compartment B, 70% in compartment C
ind.vary <- c(2,3)  # compartments 2 and 3 may vary
ind.fixed <- 1   # fix value of compartment 1
par.fixed <- 0   # fix that value at 0

Qfun4subset(pvec.vary, yy, gmat, ind.vary=ind.vary,
           ind.fixed=ind.fixed, par.fixed=par.fixed)


mooredf22/protlocassign documentation built on Sept. 13, 2023, 3:57 p.m.