Hi
Math is not my strong point but I do have a math problem that I need help on.
IT is an 2 stage problem where I think I have got stage one sorted.. I need help on stage 2. (using 2 curves to do an prediction)
Stage 1. Build a Standard Lactation Curve for a group of animals
We take a group of animals and Build a milk production history inside that group. (Sets are about 10 000 records)
x axis is LactationLength (Days in milk)
y axis is MilkYield.
I have taken that data in used this function polynomialfit on all records on that group
int m = 6;
int info;
alglib.barycentricinterpolant p;
alglib.polynomialfitreport rep;
double v;
List<double> xList = new List<double>();
List<double> yList = new List<double>();
foreach (var resitem in ProductionData)
{
xList.Add(resitem.LactationLength.Value);
yList.Add(resitem.MilkYield24H.Value);
}
alglib.polynomialfit(xList.ToArray(), yList.ToArray(), m, out info, out p, out rep);
Now if I do this..
for (int i = 10; i <= 330; i += 20)
{
double v = alglib.barycentriccalc(p, i);
SLacts lact = new SLacts();
lact.LactationLength = i;
lact.MilkYieldAvg = v;
Results20DaysInterval.Add(lact);
}
and I display the results I get an Very nice looking curve And I get exactly what I want..
Stage 2
NOW
My Second Stage is the prediction part. To do take production data of any animal that would fit within this group And try to estimate it yield on any x value(lactationlenght).
I have
1. For Example I would have First 4 ACTUAL (Measured) Y values (MilkYield) .. At example 40,75,110,140 x value(lactationlenght).
2. The Standard lactation Curve that I calculated at stage 1.
I now have to somehow use 1 and 2 to build an new estimated curve (Predicted curve) for this animal..
I have implemented my own way of plotting the new curve but I was wondering if there is alglib could do it for me.
Attachment:
The attachment Slacts150.jpg is no longer available
IN the about chart you will see
The Red line called slactsFixedMilkyield (this is the data from stage 1)
The Green Line would be the ObservedMilkYield .. Been the actual values that I need to base the prediction on.
The Blue line is the FixedMilkYield This is what I am looking For. THE Predicted Cure..Any help would be Greatly appreciated
Regards