Deming regression - eliminate one solution by sign of 2nd derivative at root of 1st
|
08-04-2019, 09:37 PM
(This post was last modified: 08-05-2019 08:40 PM by Hans Wurst.)
Post: #1
|
|||
|
|||
Deming regression - eliminate one solution by sign of 2nd derivative at root of 1st
To be more precise, it's only about one special case of Deming regression, the orthogonal R. This is a spin-off from this thread to fokus on the second issue with several problems (for me).
What I did so far: start HP Prime Virtual Calculator, Menu/Calculator/Reset... and hit Yes to confirm 'clear all memory'. Hit CAS. i) Save the formula "Sum sqared orthogonal distances from observation data to best fit straight line y=mx+b" for later use: a=sum((y(k)-(m*x(k)+b))^2,k,1,n)/(1+m^2) ii) Find b by solving da/db=0: \(\textbf{zero}\left (\frac{\partial a}{\partial b}, b \right )\) Expected result: \(b=\bar{y}-m*\bar{x}\) with overbar indicating 'arithmetic average'. HP Prime shows: ["Invalid function x(k) perhaps a missing * for multiplication Error: Bad Argument Value"] Question: what do I wrong? iii) Substitute b (found elsewhere) in a: subst(a,b=((sum(y(k),k,1,n)-m*sum(x(k),k,1,n))/n)) Note: I do not know (yet) if HP Prime "knows" overbar so I spelled out the arithmetic means of x and y. Result: sum((-m*x(k)-(-m*sum(x(k),k,1,n)+sum(y(k),k,1,n))/n+y(k))^2,k,1,n)/(m^2+1) Note: I did not check if this is what I expected because next step fails anyway. iv) As this formula looks awful (or awesome?) I tried to simplify it, inspired by the formulas given in HP-IOC Owner's Handbook, Appendix B, p. 103. Alas, subst() does just the reverse what I'd llike to do. Instead of replacing a single variable by the content of the stored one I want it to find the stored parts of a variable and replace those therms by the letter of the variable. Example: if n*sum(x(k)^2,k,1,n)-sum(x(k),k,1,n)^2 is found in the formula it should be replaced by u. Question: Is the CAS of HP Prime able to do so? I assume yes, I only could not find it in the manual. Expected result would be: \(\displaystyle \frac{m^2*u-2*m*w+v}{n*(1+m^2)}\) (found elsewhere). Saved it in a. v) Find m by da/dm=0: \(\textbf{simplify}\left (\textbf{zero}\left (\frac{\partial a}{\partial m}, m \right ) \right )\) Result: [(-u+v+√(u^2-2*u*v+v^2+4*w^2))/(2*w),(-u+v-√(u^2-2*u*v+v^2+4*w^2))/(2*w)] Save it as r (like roots). Another simplification would be nice, like in step iv I do not know how to let {v-u=>p,2*w=>q}; vi) Find sign of 2nd derivative at first root of 1st derivative (positive indicates a minimum). subst(diff(a,m,2),m=r(1)) Result: have fun fiddling out the sign of this 'conglomeration' I see no chance without a. m. simplifications and eliminate all not changing the sign of the formula. I hope it is obvious what I miss: the canonical way to define items \(x_i\) and \(y_i\) in sums to avoid "Invalid function x(k)..." error and how to do a "reverse substitute", for example replace all occurences of u-v in a formula by variable p. TIA H. Edit: 100 viewes, 0 replies. No answer is also an answer. I may conclude either i) Prime may do a lot but not what I try, or ii) false, Prime may do it, but nobody knows how, or iii) false too, alas the experts keep the secret. It is what it is. I quit. |
|||
« Next Oldest | Next Newest »
|
Messages In This Thread |
Deming regression - eliminate one solution by sign of 2nd derivative at root of 1st - Hans Wurst - 08-04-2019 09:37 PM
RE: Deming regression - eliminate one solution by sign of 2nd derivative at root of 1st - Arno K - 08-06-2019, 02:05 PM
RE: Deming regression - Aries - 08-06-2019, 04:11 PM
RE: Deming regression - eliminate one solution by sign of 2nd derivative at root of 1st - StephenG1CMZ - 08-06-2019, 05:31 PM
|
User(s) browsing this thread: 1 Guest(s)