forum.alglib.net

ALGLIB forum
It is currently Thu Mar 28, 2024 7:42 pm

All times are UTC


Forum rules


1. This forum can be used for discussion of both ALGLIB-related and general numerical analysis questions
2. This forum is English-only - postings in other languages will be removed.



Post new topic Reply to topic  [ 1 post ] 
Author Message
 Post subject: Curve Fitting / Prediction Math NOOB help
PostPosted: Tue Dec 17, 2013 8:22 am 
Offline

Joined: Tue Dec 17, 2013 7:27 am
Posts: 1
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


Attachments:
Slacts150.jpg
Slacts150.jpg [ 145.83 KiB | Viewed 3130 times ]
Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 1 post ] 

All times are UTC


Who is online

Users browsing this forum: No registered users and 60 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group