Qfun4: Goodness-of-fit internal function

View source: R/cpaProgs.R

Qfun4R Documentation

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

Usage

Qfun4(pvec, y, gmat, methodQ = "sumsquares")

Arguments

pvec

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

y

specified profile

gmat

matrix of reference profiles

methodQ

either 'sumsquares' (default) or 'sumabsvalue'

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)
# make vector for a specified profile to be evaluated
yy <- c(0.2, 0.15, 0.15, 0.5)
# make vector for candidate CPA value to be evaluated
pvec1 <- c(1, 0, 0)  # 100% in compartment A, 0% in compartment B2,
 #  0% in compartment C
pvec2<-c(0, 1, 0)  # 0% in compartment A, 100% in compartment B2, 
 #  0% in compartment C
pvec3<-c(0,0,1)  # 0% in compartment A, 0% in compartment B2, 
 #  100% in compartment C
pvec4<-c(0.2, 0.3, 0.5) #20% in compartment A, 30% in compartment B2, 
 #  50% in compartment C

Qfun4(pvec1, yy, gmat)
Qfun4(pvec2, yy, gmat)
Qfun4(pvec3, yy, gmat)
Qfun4(pvec4, yy, gmat)


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