# wifac

Weighted Integrated Factor returns a vector with four values: peak, peak time, wifac, and total.

## Syntax

wifac(xvect_1, yvect_1, xvect_2, yvect_2, flag)

## Argument

xvect_1
First X vector of the data to be analyzed.
yvect_1
First Y vector of the data to be analyzed.
xvect_2
Second X vector of the data to be analyzed.
yvect_2
Second Y vector of the data to be analyzed.
flag
Flag to turn on the mode (optional argument).
0
Weighting peak: Peak score can be calculated using the formula in the Comments and the weight of the peak score.
1
Weighting peak time: Peak time score can be calculated using the formula in the Comments and the weight of the peak time score.
2
Weighting WIFac: The weight of the WIFac.

## Example

retvec = wifac(p1w1c1.x,p1w1c1.y, p1w1c2.x,p1w1c2.y)
Peak = retvec[0]
Peak Time = retvec[1]
Wifac = retvec[2]
Total = retvec[3]

This operator allows comparing two curves (f and g) by evaluating four different scores:
1. Peak score = max(0,Mf*Mg) / max(Mf²,Mg²)
2. Peak time score = max(0,Af*Ag) / max(Af²,Ag²) where:
• Mf = maximum ordinate of curve f
• Mg = maximum ordinate of curve g
• Af = abscissa of the maximum ordinate of curve f
• Ag = abscissa of the maximum ordinate of curve g
3. The initial formulation of the WIFac score is shown below:

An improved formulation of the WIFac score has been implemented (it is activated using the fourth input parameter; see below):

4. Total score = (a*S1 + b*S2 + g*S3) / (a + b + g)
where:
• a, b and g are scalar values defined by the user.
• S1 represents the peak score.
• S2 represents the peak time score.
• S3 represents the WIFac score
Note: The WIFac Templex function returns only usable results if the curve is mostly positive and bell shaped. The automir function is used in the notes to mirror the curves in case they are negative and cup shaped. This function returns -1 or 1, depending on the given values.