T O P I C R E V I E W |
pirfo |
Posted - 12/19/2003 : 07:47:29 AM Hi, How can I add my own function for multiple regression analysis? I have 1 depe (given), 3 indep (given), 5 parameters I want to calculate their values by my function. Should I go to NLSF or add some lines to multiple regression model script? thanks Soraia
Edited by - pirfo on 12/19/2003 08:15:26 AM |
6 L A T E S T R E P L I E S (Newest First) |
Gary Lane |
Posted - 12/24/2003 : 12:07:52 PM Hi,
In Origin 7.5 I was able to get values returned even with simplistic and make believe data...so I think your function is good. I am not sure what version of Origin you have and it would help knowing. Also please tell me what your parameter constraints are.
You may have some other minor setting problems:
1. If using Origin C function make sure your parameters and variables agree in case...C is case sensitive. 2. If not using Origin C then use the Y-Script form of equation and make sure you use function exactly as you posted. 3. Make sure your constraints are mathematically correct...for example x^0.5 would require x >= 0. 4. Make sure you list all variables and parameters above equation in proper case: Parameter Names: A1,B1,x0,C1,xP,C3 Independent Var: x,Cu,Ph Independent Var: y 5. Make sure you initialize all parameters and each variable has a data set assigned. 6. Maybe try fitting without constraints to see if that isolates problem.
If none of above suggestions fix problem send your data to tech@OriginLab.com with ATTN: gary in subject. Include version of Origin and the constraints you are enforcing.
Please note that when fitting multiple independent variables the Simulate function does not work very well (and sometimes not at all). We know about this and should be fixing it soon.
Good luck!
Gary
Edited by - Gary Lane on 12/24/2003 12:13:07 PM |
easwar |
Posted - 12/24/2003 : 11:58:19 AM Hi Soraia,
What version of Origin are you using? If it is ver 7 or higher, Origin C is used by default. The function definition thus has to follow C syntax, such as variables being case sensitive etc. If you are using 7 or higher, try clicking on the "Edit in Code Builder" button, then try compiling the function in Code Builder to see what errors you are getting.
Easwar.
|
pirfo |
Posted - 12/23/2003 : 5:25:02 PM Dear Gary Lane, first of all thank you so much!! I read all suggested me but I am not getting it. Maybe I am stupid!
My eq is y=A1*x^0.5+B1*(Cu-0.05)*(1-exp(-x/x0))+C1*(Ph-0.008)*(0.5+0.5*tanh ( (x-xP) /C3) ) Cu, Ph and x are dataset columns y is also a dataset column. I have initial and lower and upper bound of the parameters:A1,B1,x0,C1,xP and C3
So I would like to get the best values for the parameters. Now I am getting Error my fitting functions is not generating values and even I do not get to simulate the function.
Sorry, could you help again?!
Soraia
|
Gary Lane |
Posted - 12/23/2003 : 10:38:13 AM Hi Soraia,
Easwar is away on holiday so I decided to jump in and try to help.
You should be able to fit 3 indep vars and 1 dep var in a user defined equation. I think Easwar misspoke when he said "multiple-dep var" in fact I think he meant "multiple-indep var" (e.g. x1, x2, x3).
For a simple example see equation below:
y = A*x1 + B*x2 + C*x3;
In my experience error 28036 generally occurs when there is a missing or bad parameter initialization on the Action:Fit page of the fitter. Be sure to create function (Function:New), assign 1 dep and 3 indep datasets (Action:Dataset), and then initialize all parameters and click Iterate button (Action:Fit).
See the following link for a detailed tutorial on how to create a user-defined equation: http://www.originlab.com/index.aspx?s=9&pid=537
See the following link for a detailed tutorial on how to create a user-defined equation with multiple indep vars:
http://www.originlab.com/index.aspx?s=9&pid=434
I hope this is helpful. I will be in today and tomorrow (EST 9-5 PM) but out on Thursday and Friday...reply back if you need more help.
Good luck!
Gary
Edited by - Gary Lane on 12/23/2003 10:41:40 AM |
pirfo |
Posted - 12/23/2003 : 07:54:21 AM Dear Easwar,
I had been working in your answer I did not got it. I enter the function, I set the 3 ind and the 1 dep. On edit I defined from equation. I assign the dataset and try to fit. I get error 28036 each time for one parameter, even now I did not bound then to a lower and upper values. Mean you by "multiple-dep var" that 3 indep should be dep ? Thnaks so much because to resolve this problem is so important. Soraia |
easwar |
Posted - 12/19/2003 : 10:49:21 AM Hi Soraia,
Easiest would be to just set up a multiple-dep var fitting function in NLSF. You should get the same result.
One other thing to note is that results reported will be somewhat different. Multiple regression reports for instance t-value on each parameter etc. But if you are mainly looking for coefficient value and error on the coefficients, you can get that from NLSF.
Easwar OriginLab.
|
|
|