Items tagged with fitting

Feed

hello i was wondering is it possible to find the standard error of the coefficents in the NonlinearFit function within the statistical package? or in any other package for that matter?

does someone have angorithme that can find it? 

i've searched around the internet and it does not seem like maple employs this function at all?

hope someone can help:)

hello agian i have the following problem. i need to fit data using the following model:

ode_sub := diff(S(t), t) = -k1*S(t)-S(t)/T1_s;

ode_P1 := diff(P1(t), t) = 2*k1*S(t)-k2*(P1(t)-P2(t)/keq)-P1(t)/T1_p1;

ode_P2 := diff(P2(t), t) = -k2*(-keq*P1(t)+P2(t))/keq-k4*P2(t)-P2(t)/T1_p2;

ode_P2e := diff(P2_e(t), t) = k4*P2(t)-P2_e(t)/T1_p2_e;

ode_system := ode_sub, ode_P1, ode_P2, ode_P2e

known paramters: s0 := 10000; k2 := 1000; T1_s := 14; T1_p2_e := 35; T1_p2 := T1_p1

initial conditions: init := S(0) = s0, P1(0) = 0, P2(0) = 0, P2_e(0) = 0

using the following data the fitting is fine:

T := [0, 2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26, 28, 30, 32, 34, 36, 38, 40, 42, 44, 46, 48, 50, 52, 54, 56, 58, 60, 62, 64, 66, 68, 70, 72, 74, 76, 78, 80, 82, 84, 86, 88, 90, 92, 94, 96, 98, 100]

data_s := [10000.00001377746, 7880.718836217512, 6210.572917625112, 4894.377814704496, 3857.121616806618, 3039.689036293312, 2395.493468824973, 1887.821030424934, 1487.738721378254, 1172.445015238064, 923.970970533911, 728.1555148262845, 573.8389058920359, 452.2263410725434, 356.3868133709972, 280.8584641247961, 221.3366863178145, 174.4291648589732, 137.4627967029932, 108.3305246342751, 85.37230370803576, 67.2794974831867, 53.0210755540487, 41.78436556408739, 32.92915589156605, 25.95049906181449, 20.45092590987601, 16.11678944747619, 12.70115104646253, 10.009439492356, 7.888058666357939, 6.216464754698855, 4.899036441885205, 3.860793948052506, 3.042584031379331, 2.397778731385364, 1.889601342133927, 1.489145259940784, 1.173591417634974, .9248694992255094, .7288443588090404, .5743879613705721, .4526024635132348, .3567687570029392, .2810508404011898, .2215650452813882, .174603181767829, .1376243372528356, .1084232889842753, 0.8542884707952822e-1, 0.6738282660463157e-1]

data_p1 := [0.1194335334401124e-4, 244.8746046039949, 374.8721199398692, 430.5392805383767, 439.6598364813143, 421.0353424914179, 387.1842556288343, 346.2646897222593, 303.4377508746471, 261.8283447091155, 223.1996547160051, 188.4213144493491, 157.7924449350029, 131.2622073983344, 108.5771635112278, 89.37951009190863, 73.26979150957087, 59.84578653950572, 48.72563358658898, 39.56010490461378, 32.03855466968536, 25.88922670933322, 20.87834763772145, 16.80708274458702, 13.50774122768974, 10.84014148654258, 8.687656394505874, 6.954093898245485, 5.560224107929433, 4.441209458524726, 3.544128529596104, 2.825755811619965, 2.251247757181308, 1.792233305651086, 1.425861347838012, 1.133566009019768, .90081361320016, .7153496336919163, .5678861241754847, .4505952916932289, .3572989037753538, .2832489239941939, .2244289868248577, .1778450590752305, .1408633578784151, .1114667192753896, 0.8826814044702111e-1, 0.6979315954603076e-1, 0.5526502783606788e-1, 0.4370354298880999e-1, 0.3456334307662573e-1]

data_p2_p2e := [-0.1821397630630296e-4, 1000.40572909871, 1568.064904416198, 1848.900129881268, 1944.147939710225, 1923.352973299286, 1833.705314342611, 1706.726235937363, 1563.036042115902, 1415.741121363331, 1272.825952816517, 1138.833091575137, 1016.03557293539, 905.2470623752856, 806.3754051707843, 718.7979384094563, 641.6091822001032, 573.7825966275556, 514.2718125966452, 462.0710416682647, 416.2491499591012, 375.9656328260581, 340.4748518743264, 309.124348579787, 281.3484612079911, 256.6599441255977, 234.6416876403397, 214.9378461256197, 197.2453333305823, 181.3059798685686, 166.90059218783, 153.8422174795751, 141.9717783871606, 131.1529759058513, 121.2692959115991, 112.2199678247825, 103.9187616370328, 96.29007054510998, 89.26877137303566, 82.79743967408479, 76.82586273439793, 71.30944943617081, 66.2085909515396, 61.48838150744805, 57.11714763242225, 53.06666224006544, 49.31130738219119, 45.82807853990728, 42.59597194910467, 39.59575450632008, 36.81013335261527]

the fitting is done the following way: 

P1fu, P2fu, P2e_fu, Sfu := op(subs(res, [P1(t), P2(t), P2_e(t), S(t)]))

making residuals:

Q := proc (T1_p1, k1, keq, k4) local P1v, P2v, P2e_v, Sv, resid; option remember;

res(parameters = [T1_p1, k1, keq, k4]);

try P1v := `~`[P1fu](T); P2v := `~`[P2fu](T); P2e_v := `~`[P2e_fu](T); Sv := `~`[Sfu](T); resid := [P1v-data_p1, P2v+P2e_v-data_p2_p2e, Sv-data_s]; return [seq(seq(resid[i][j], i = 1 .. 3), j = 1 .. nops(T))] catch: return [1000000$3*nops(T)] end try end proc;
q := [seq(subs(_nn = n, proc (T1_p1, k1, keq, k4) Q(args)[_nn] end proc), n = 1 .. 3*nops(T))];

finding inital point for the LSsolve:

L := fsolve(q[2 .. 5], [10, 0.2e-1, 4, 4])

fitting the data with the intial point: 

solLS := Optimization:-LSSolve(q, initialpoint = L)

this is all good however, when i used the following data it did not turn out so well (using the same approch as above):

data_s := [96304.74567, 77385.03700, 62621.83067, 51239.94333, 42663.82367, 35084.74100, 28480.28367, 23066.01467, 18774.73700, 15179.13700, 12278.50767, 9937.652000, 8046.848333, 6521.242000, 5287.811667, 4277.779000, 3466.518333, 2835.467000, 2297.796333, 1861.249667, 1529.654000, 1235.353000, 999.6626667, 826.2343333, 667.9480000, 559.9230000, 449.2790000, 376.4860000, 289.1203333, 236.1483333]

data_p1 := [0.86e-1, 3.904, 26.975, 31.719, 41.067, 46.779, 52.115, 43.101, 44.344, 41.094, 36.523, 27.742, 26.543, 28.062, 22.178, 21.303, 14.951, 17.871, 11.422, 12.051, 9.232, 6.817, 6.1, .717, 1.215, 6.146, .772, .375, 2.595, .518]

data_p2_p2e := [-3.024, 22.238, 61.731, 103.816, 132.695, 159.069, 167.302, 160.188, 158.398, 152.943, 146.745, 135.22, 132.145, 120.413, 107.864, 95.339, 90.775, 81.828, 71.065, 70.475, 62.872, 49.955, 40.858, 42.938, 41.311, 35.583, 31.573, 29.841, 29.558, 21.762]

the known parameters is the case are:

s0 := 96304.74567; k2 := 10^5; T1_s := 14; T1_p2_e := 35; T1_p2 := T1_p1

additionally the following fuction affects the solution: 

K:=t->cos((1/180)*beta*Pi)^(t/Tr)

i included this by doing this:

P1fu_K := proc (t) options operator, arrow; P1fu(t)*K(t) end proc;

P2fu_K := proc (t) options operator, arrow; P2fu(t)*K(t) end proc;

P2e_fu_K := proc (t) options operator, arrow;

P2e_fu(t)*K(t) end proc;

Sfu_K := proc (t) options operator, arrow; Sfu(t)*K(t) end proc

resulting in the following residuals:

Q := proc (T1_p1, k1, keq, k4) local P1v, P2v, P2e_v, Sv, resid; option remember;

res(parameters = [T1_p1, k1, keq, k4]);

try P1v := `~`[P1fu_K](T); P2v := `~`[P2fu_K](T); P2e_v := `~`[P2e_fu_K](T); Sv := `~`[Sfu_K](T); resid := [P1v-data_p1, P2v+P2e_v-data_p2_p2e, Sv-data_s]; return [seq(seq(resid[i][j], i = 1 .. 3), j = 1 .. nops(T))] catch: return [1000000$3*nops(T)] end try end proc;
q := [seq(subs(_nn = n, proc (T1_p1, k1, keq, k4) Q(args)[_nn] end proc), n = 1 .. 3*nops(T))];

i think my problem is that the inital point in this case is not known. all i know is that all the fitted parameters should be positive and that k1<1, k4>10, keq>1 and T1_p1>100 (more i do not know) - is there a way to determin the inital point without guessing?

i also know the results, which should be close to these values:

k1=0.000438, k4=0.0385, keq=2.7385 and T1_p1=36.8 the output fit should look something like this

where the red curve is (PP2(t)+PP2_e(t))*K(t)

the blue cure is PP1(t)*K(t) 

anyone able to help - i've tried for 2 days now. it might be that  ode_P1 := diff(P1(t), t) = 2*k1*S(t)-k2*(P1(t)-P2(t)/keq)-P1(t)/T1_p1 should be changed into ode_P1 := diff(P1(t), t) = k1*S(t)-k2*(P1(t)-P2(t)/keq)-P1(t)/T1_p1;

i've tried this but it didnt seem to do much 

anyone able to help?:)

NB stiff=true can be used within the dsolve to speed up the process if needed:)

 

 

 

 


 

 

Dear All,

 

I am a new Maple user and I am still unaware of a lots of fancy features of Maple. I have a problem of simultaneous fitting polynomials. I wish that I could have help from you. Say, we have two polynomials of two variables,

f1(x,y)=a1+a2*x+a3*y+(a4+a5)*x2+(a4-a5)*y2;

f2(x,y)=b1+b2*x+b3*y+(a4-a5)*x2+(a4+a5)*y2.

Note that a4 and a5 are shared by the two polynomials. I would like to fit the two polynomials against their respective data set. Is there anyway I can do it using Maple? Any of your help is highly appreciated!

 

Best regards,

 

Toby

Dear Community,

I've made a nonlinear curve fit with the Minimize routine (see attachment). What would be an easy and elegant way to rerun the model (Model) with the fitted values of a, b, c and plot the result together with the measured points in the same chart? I'm stuck here.

Tx in advance,

best regards

Andras

BroSzem_Data.xlsx

Nonlin_Curve_Fit.mw

 

Dear Maple users

Physical experiment: I dropped a ball with low mass from a height of approximately 7 meters and wanted to test if the air resistance was proportional to the square of the velocity. I filmed the fall and used the program Logger Pro to collect data: a number of datapoints (time,height) was collected. I copy/pasted the datapoints into MS Excel, from where I could import data into Maple via Tools > Assistants > Import Data ... Then I wanted to make a fit with the theoretical solution, given by a function having just one parameter: the Drag coefficient. Unfortunately I received an error "complex values encountered" (see below). I can solve the problem manual by making a number of guesses for the drag coefficient, until the theoretical curve approximates the data points well. I wanted to make Maple do the fitting job, though. I will appreciate if someone could give an idea how to fit the data properly.

NB! Mass m and g is defined above in the Maple document. The Statistics and plots package is called too.

I have a function fitted and found the coeffiecients, the coeffiecient values are found with data from maple

the function is: a*(x+b/c)

my result is 5x+15

How do I get the values of a, b and c? The value of a is 5 that I know, but how does I get that maple gives me all the values of a,b  and c? The problem is that I get one value while i need the values of a, b and c.

Thanks

Ok guys, so i have a bunch of datapoints in 3d (x,y,z)

I'm trying to calculate an equation using maple that will express z as a function of x and y.

I've been browesing around for like 2 hours now with no hope. Help?

 

Hi. It is be good to be with you after 4 years.

I want to ask about Curvefitting for Data. If I have a numerical data and i want to find a function in x and y for these data.

i have a non linear equation that depends on three variables e, theta and z.

i have done calculations to calculate e while varying theta and z. theta varied among the vector [0, Pi/4, Pi/3, Pi/2] and z was varying between 1 and 20

when plotting my data it gives the following plot where z is represented on the x-axis and each curve correspond to one theta

 

i am currently able of fitting one plot to one equation i would like to fit the data points using the nonlinearfit function and to only get one equation for all the plots. is that possible in maple or not

 

Hey, I have some data points:

 

I than entered:

X := Data[() .. (), 1];
Y := Data[() .. (), 2];
f := a+b*x^c+d*x^e;
Statistics:-NonlinearFit(f, X, Y, x);
 and when I entered Statistics:-NonlinearFit(f, X, Y, x);, It wouldn't output anything.

Hello,

 

I am new to Maple.

I have a set of spreadsheet data :(x1, y1), (x2, y2) .....(xn,yn).

And I have an equation that contains an infinite series with unkowns.

e.g.) y=  A*x + sum ( B * exp(-n^2 * (x-C)) /n^2, n=1..infinity);

Where A, B, C are unkowns, which I want to get optimized values for the spreadsheet data fitting.

 

Please let me know.

Sung Yeol

Find the function f:\mathbb{R}\to\mathbb{R} satisfying the following conditions:

f(-6)=2400,f(-4)=432,f(-3)=120,f(-2...

Hey guys

I am currently working on my final project in high school. This project is about mathematical modelling within epidemology, and i am currently working on the mathematical models based on the SIR model.

The basis models for the SIR model were pretty easy, but i cant figure out how to fit data to my models. My first idea was to use the method of Leastsquare and/or Nonlinearfit, but i cant figure out how to do this in maple.

HI,

 

I measured some points. This points are plotted in a graph. Now I want to make a fit on this points.

I now that the fit-function has to be like this:

F = A + B1 x e^(-t/C1) + B2 x e^(-t/C2)

Problem: how can I create a fitting function like that?

 

The best thing I found is the "spline"-fit, but it doesn't work properly. It has to be one lonely function, not a summary of several functions (like spline).

Hi, I'm trying to fit an equation:

starting_salary= (intercept+SEX*B0) +B1*GPA  +B2* METRICS

(metrics,sex are  dummy variables, either 0 or 1) to see how sex coefficient affects the intercept ( how it affects starting_salary)

(later on I  want to see how metrics affects starting_salary for either sex=1 and sex =0 .. anyways I disgress) 

STARTING_SALARY :=:  

GPA:=:      

METRICS: =;  

1 2 Page 1 of 2