cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
  • JMP will suspend normal business operations for our Winter Holiday beginning on Wednesday, Dec. 24, 2025, at 5:00 p.m. ET (2:00 p.m. ET for JMP Accounts Receivable).
    Regular business hours will resume at 9:00 a.m. EST on Friday, Jan. 2, 2026.
  • We’re retiring the File Exchange at the end of this year. The JMP Marketplace is now your destination for add-ins and extensions.

Discussions

Solve problems, and share tips and tricks with other JMP users.
%3CLINGO-SUB%20id%3D%22lingo-sub-332747%22%20slang%3D%22en-US%22%20mode%3D%22UPDATE%22%3EMinimize()%20%E9%96%A2%E6%95%B0%E3%81%AB%E3%82%88%E3%81%A3%E3%81%A6%E8%BF%94%E3%81%95%E3%82%8C%E3%82%8B%E3%83%98%E3%83%83%E3%82%BB%E8%A1%8C%E5%88%97%E3%81%8B%E3%82%89%E3%83%91%E3%83%A9%E3%83%A1%E3%83%BC%E3%82%BF%20std%20%E8%AA%A4%E5%B7%AE%20(%E3%81%BE%E3%81%9F%E3%81%AF%E6%A8%99%E6%BA%96%E5%81%8F%E5%B7%AE)%20%E3%82%92%E8%A8%88%E7%AE%97%E3%81%99%E3%82%8B%E3%81%AB%E3%81%AF%E3%81%A9%E3%81%86%E3%81%99%E3%82%8C%E3%81%B0%E3%82%88%E3%81%84%E3%81%A7%E3%81%97%E3%82%87%E3%81%86%E3%81%8B%3F%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-332747%22%20slang%3D%22en-US%22%20mode%3D%22UPDATE%22%3E%3CP%3E%E3%81%93%E3%82%93%E3%81%AB%E3%81%A1%E3%81%AF%E3%80%81%3C%2FP%3E%3CP%3E%20%3C%2FP%3E%3CP%3E%E3%82%AA%E3%83%97%E3%82%B7%E3%83%A7%E3%83%B3%E3%83%91%E3%83%A9%E3%83%A1%E3%83%BC%E3%82%BF%26lt%3B%E3%82%92%E4%BD%BF%E7%94%A8%E3%81%97%E3%81%A6minimize()%E3%82%92%E4%BD%BF%E7%94%A8%E3%81%97%E3%81%A6%E3%83%91%E3%83%A9%E3%83%A1%E3%83%BC%E3%82%BF%E6%8E%A8%E5%AE%9A%E5%80%A4%E3%81%AE%E6%A8%99%E6%BA%96%E8%AA%A4%E5%B7%AE%E3%82%92%E8%A8%88%E7%AE%97%E3%81%99%E3%82%8B%E9%9A%9B%E3%81%AB%E5%95%8F%E9%A1%8C%E3%81%8C%E3%81%82%E3%82%8A%E3%81%BE%E3%81%99%E3%80%82%20%3CSHOWDETAILS%20which%3D%22%22%20returns%3D%22%22%20a%3D%22%22%20few%3D%22%22%20extra%3D%22%22%20values%3D%22%22%20including%3D%22%22%20the%3D%22%22%20hessian%3D%22%22%20matrix.%3D%22%22%3E%3C%2FSHOWDETAILS%3E%3C%2FP%3E%3CP%3E%E3%83%98%E3%83%83%E3%82%BB%E8%A1%8C%E5%88%97%E3%81%AB%E3%81%A4%E3%81%84%E3%81%A6%E3%81%AE%E7%A7%81%E3%81%AE%EF%BC%88%E3%81%8B%E3%81%AA%E3%82%8A%E5%9F%BA%E6%9C%AC%E7%9A%84%E3%81%AA%EF%BC%89%E7%90%86%E8%A7%A3%E3%81%AF%E3%80%81%E5%AF%BE%E8%A7%92%E8%A6%81%E7%B4%A0%E3%81%8C%E5%88%86%E6%95%A3%E3%81%AE%E9%80%86%E6%95%B0%E3%81%AE%E9%81%A9%E5%88%87%E3%81%AA%E8%BF%91%E4%BC%BC%E5%80%A4%E3%81%AB%E3%81%AA%E3%82%8B%E3%81%AF%E3%81%9A%E3%81%A0%E3%81%A8%E3%81%84%E3%81%86%E3%81%93%E3%81%A8%E3%81%A7%E3%81%99%E3%80%82%E3%81%97%E3%81%8B%E3%81%97%E3%80%81%E3%81%93%E3%81%AE%E3%82%88%E3%81%86%E3%81%AB%E6%8A%BD%E5%87%BA%E3%81%95%E3%82%8C%E3%81%9F%E5%80%A4%E3%81%A8%E5%8D%98%E7%B4%94%E3%81%AA%E7%B7%9A%E5%BD%A2%E5%9B%9E%E5%B8%B0%E3%81%8B%E3%82%89%E5%BE%97%E3%82%89%E3%82%8C%E3%82%8B%E5%80%A4%E3%81%A8%E3%81%AE%E9%96%93%E3%81%AB%E3%81%AF%E3%80%81%E8%89%AF%E3%81%84%E4%B8%80%E8%87%B4%E3%81%8C%E5%BE%97%E3%82%89%E3%82%8C%E3%81%BE%E3%81%9B%E3%82%93%E3%80%82%3C%2FP%3E%3CP%3E%E4%BB%A5%E4%B8%8B%E3%81%AB%E4%BE%8B%E3%82%92%E6%8C%99%E3%81%92%E3%81%A6%E8%AA%AC%E6%98%8E%E3%81%97%E3%81%BE%E3%81%99%E3%80%82%3C%2FP%3E%3CPRE%3E%3CCODE%20class%3D%22%20language-jsl%22%3Ex%20%3D%20%5B1.309%2C%201.471%2C%201.49%2C%201.565%2C%201.611%2C%201.68%5D%3B%0Ay%20%3D%20%5B2.138%2C%203.421%2C%203.597%2C%204.34%2C%204.882%2C%205.66%5D%3B%0Ab1%20%3D%201%3B%20%2F*starting%20value%20for%20b1%20*%2F%0Ab2%20%3D%205%3B%20%2F*starting%20value%20for%20b2%20*%2F%0AsseExpr%20%3D%20Expr(%0A%20%20%20%20%20%20%20Summation(%20i%20%3D%201%2C%206%2C%20(y%5Bi%5D%20-%20(b1%20%2Bb2*x%5Bi%5D%20))%20%5E%202%20)%0A)%3B%0A%2F%2FUse%20Minimize%20%0A%7BobjVal%2C%20iters%2C%20gradient%2C%20hessian%7D%20%20%3D%20Minimize(%20sseExpr%2C%20%7Bb1%2C%20b2%7D%20%2C%26lt%3B%3CSHOWDETAILS%3E%3C%2FSHOWDETAILS%3E%3CBR%20%2F%3E%3C%2FCODE%3E%3C%2FPRE%3E%3CP%3E%E3%81%9D%E3%81%AE%E7%B5%90%E6%9E%9C%E3%81%AF%E4%BB%A5%E4%B8%8B%E3%81%AE%E9%80%9A%E3%82%8A%E3%81%A7%E3%81%99%E3%80%82%3C%2FP%3E%3CPRE%3E%3CCODE%20class%3D%22%20language-jsl%22%3EnParm%3D2%20%20Newton%20%20%20******************************************************%0A%0AIter%20%20%20nFree%20%20%20Objective%20%20RelGrad%20%20%20%20NormGrad2%20%20Ridge%20%20%20nObj%20%20%20nGrad%20%20%20nHess%20%20%20Parm0%20%20%20%20%20%20Parm1%20%20%20%20%20%20%0A0%20%20%20%20%20%202%20%20%20%20%20%20%20128.6484%20%20%2020788.83%20%20%204982.355%20%20%200%20%20%20%20%20%20%201%20%20%20%20%20%201%20%20%20%20%20%20%201%20%20%20%20%20%20%201%20%20%20%20%20%20%20%20%20%205%20%20%20%20%20%20%20%20%20%20%0A1%20%20%20%20%20%202%20%20%20%20%20%20%200.074605%20%20%207.56e-25%20%20%201.88e-25%20%20%200%20%20%20%20%20%20%201%20%20%20%20%20%201%20%20%20%20%20%20%201%20%20%20%20%20%20%20-10.427%20%20%20%209.489346%20%20%20%0AConvergence%20SUCCESS%3A%20Gradient%0ATime%3A%200.0166666667209938%0A%0A%0A********************************************************************%0A************%20%20%20%20%20Parameter%20Estimates%20%20%20%20%20%20**************************%0A********************************************************************%0ATerm%20%20%20%20%20%20%20%20%20%20%20Estimates%20%20%20%20%20%20Std%20Error%20%20%20%20%20%20t%20Ratio%20%20%20%20%20%20%20%20Prob%26gt%3B%7Ct%7C%20%20%20%20%20%20%20%0A********************************************************************%0AIntercept%20%20%20%20%20%20-10.42696%20%20%20%20%20%200.72006%20%20%20%20%20%20%20%20-14.48064%20%20%20%20%20%200.00013%20%20%20%20%20%20%20%20%0Ab1%20%20%20%20%20%20%20%20%20%20%20%20%209.48935%20%20%20%20%20%20%20%200.47199%20%20%20%20%20%20%20%2020.10486%20%20%20%20%20%20%200.00004%20%20%20%20%20%20%20%20%0A********************************************************************%0ARSquare%3A0.990201015051942%0ARSquare%20Adj%3A0.987751268814928%0A%0A%22Parameter%20b1%3D%22%3B%0AEstimates%5B1%5D%20%3D%20-10.4269614637334%3B%0Ab1%20%3D%20-10.4269614637335%3B%0A%22Parameter%20b2%22%3B%0AEstimates%5B2%5D%20%3D%209.48934569169413%3B%0Ab2%20%3D%209.48934569169416%3B%0A%22Std_error%20in%20b1%22%3B%0Astd_error%5B1%5D%20%3D%200.720062429496937%3B%0Amin_stderror%5B1%2C1%5D%20%3D%201.5220348519284%3B%0A%22Std_error%20in%20b2%22%3B%0Astd_error%5B2%5D%20%3D%200.471992539497802%3B%0Amin_stderror%5B2%2C2%5D%20%3D%200.997676125760012%3B%3C%2FCODE%3E%3C%2FPRE%3E%3CP%3E%E3%83%91%E3%83%A9%E3%83%A1%E3%83%BC%E3%82%BF%E6%8E%A8%E5%AE%9A%E5%80%A4%E3%81%AF%E5%AE%8C%E5%85%A8%E3%81%AB%E4%B8%80%E8%87%B4%E3%81%97%E3%81%A6%E3%81%84%E3%81%BE%E3%81%99%E3%81%8C%E3%80%81%E8%AA%A4%E5%B7%AE%E3%81%AF%E4%B8%80%E8%87%B4%E3%81%97%E3%81%A6%E3%81%84%E3%81%BE%E3%81%9B%E3%82%93%E3%80%82%3C%2FP%3E%3CP%3E%E3%81%97%E3%81%9F%E3%81%8C%E3%81%A3%E3%81%A6%E3%80%81%E8%B3%AA%E5%95%8F%E3%81%AF%E6%AC%A1%E3%81%AE%E3%82%88%E3%81%86%E3%81%AB%E3%81%AA%E3%82%8A%E3%81%BE%E3%81%99%3A%20%3CSTRONG%3EMinimize()%20%E9%96%A2%E6%95%B0%E3%81%AB%E3%82%88%E3%81%A3%E3%81%A6%E8%BF%94%E3%81%95%E3%82%8C%E3%82%8B%E3%83%98%E3%83%83%E3%82%BB%E8%A1%8C%E5%88%97%E3%81%8B%E3%82%89%E3%83%91%E3%83%A9%E3%83%A1%E3%83%BC%E3%82%BF%20std%20%E8%AA%A4%E5%B7%AE%20(%E3%81%BE%E3%81%9F%E3%81%AF%E6%A8%99%E6%BA%96%E5%81%8F%E5%B7%AE)%20%E3%82%92%E8%A8%88%E7%AE%97%E3%81%99%E3%82%8B%E3%81%AB%E3%81%AF%E3%81%A9%E3%81%86%E3%81%99%E3%82%8C%E3%81%B0%E3%82%88%E3%81%84%E3%81%A7%E3%81%97%E3%82%87%E3%81%86%E3%81%8B%3F%3C%2FSTRONG%3E%3C%2FP%3E%3CP%3E%20%3C%2FP%3E%3CP%3E%E3%81%94%E5%8D%94%E5%8A%9B%E3%81%82%E3%82%8A%E3%81%8C%E3%81%A8%E3%81%86%E3%81%94%E3%81%96%E3%81%84%E3%81%BE%E3%81%99%3C%2FP%3E%3CP%3E%20%3C%2FP%3E%3CP%3E%20%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-332747%22%20slang%3D%22en-US%22%20mode%3D%22UPDATE%22%3E%3CLINGO-LABEL%3E%E3%83%87%E3%83%BC%E3%82%BF%E3%81%AE%E6%8E%A2%E7%B4%A2%E3%81%A8%E8%A6%96%E8%A6%9A%E5%8C%96%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3E%E5%93%81%E8%B3%AA%E3%81%8A%E3%82%88%E3%81%B3%E3%83%97%E3%83%AD%E3%82%BB%E3%82%B9%E3%82%A8%E3%83%B3%E3%82%B8%E3%83%8B%E3%82%A2%E3%83%AA%E3%83%B3%E3%82%B0%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E
Choose Language Hide Translation Bar
ragnarl
Level II

How to compute the parameter std error (or standard deviation) from the Hessian returned by the Minimize() function?

Hello,

 

I have a problem with calculating the standard error of the parameter estimates using minimize() with the optional parameter <<showdetails which returns a few extra values including the Hessian Matrix.  

My (rather basic) understanding of the Hessian is that the diagonal elements should be a good approximation of the inverse of the variances. However, I do not get a good agreement between thus extracted values and the ones I get from simple linear regression. 

To illustrate here is an example:

x = [1.309, 1.471, 1.49, 1.565, 1.611, 1.68];
y = [2.138, 3.421, 3.597, 4.34, 4.882, 5.66];
b1 = 1; /*starting value for b1 */
b2 = 5; /*starting value for b2 */
sseExpr = Expr(
       Summation( i = 1, 6, (y[i] - (b1 +b2*x[i] )) ^ 2 )
);
//Use Minimize 
{objVal, iters, gradient, hessian}  = Minimize( sseExpr, {b1, b2} ,<<showdetails(true));
//Use Linear Regression
{Estimates, Std_Error, Diagnostics} = Linear Regression( y, x, <<printToLog );
min_stderror=sqrt(inverse(hessian)/nrows(x));

show("Parameter b1=",Estimates[1],b1);
show("Parameter b2",Estimates[2],b2);
show("Std_error in b1",std_error[1],min_stderror[1,1]);
show("Std_error in b2",std_error[2],min_stderror[2,2]);

The Result from this is shown below 

nParm=2  Newton   ******************************************************

Iter   nFree   Objective  RelGrad    NormGrad2  Ridge   nObj   nGrad   nHess   Parm0      Parm1      
0      2       128.6484   20788.83   4982.355   0       1      1       1       1          5          
1      2       0.074605   7.56e-25   1.88e-25   0       1      1       1       -10.427    9.489346   
Convergence SUCCESS: Gradient
Time: 0.0166666667209938


********************************************************************
************     Parameter Estimates      **************************
********************************************************************
Term           Estimates      Std Error      t Ratio        Prob>|t|       
********************************************************************
Intercept      -10.42696      0.72006        -14.48064      0.00013        
b1             9.48935        0.47199        20.10486       0.00004        
********************************************************************
RSquare:0.990201015051942
RSquare Adj:0.987751268814928

"Parameter b1=";
Estimates[1] = -10.4269614637334;
b1 = -10.4269614637335;
"Parameter b2";
Estimates[2] = 9.48934569169413;
b2 = 9.48934569169416;
"Std_error in b1";
std_error[1] = 0.720062429496937;
min_stderror[1,1] = 1.5220348519284;
"Std_error in b2";
std_error[2] = 0.471992539497802;
min_stderror[2,2] = 0.997676125760012;

While the parameter estimates are in perfect agreement, the errors are not. 

thus the question: How to compute the parameter std error (or standard deviation) from the Hessian returned by the Minimize() function?

 

Thanks for any assistance

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
ragnarl
Level II

Re: How to compute the parameter std error (or standard deviation) from the Hessian returned by the Minimize() function?

A colleague helped me figure out what was wrong. 

The calculation of the standard error is incorrect. It should be:

{objVal, iters, gradient, hessian} = Minimize( sseExpr, {b1, b2} ,<<showdetails(true));
if(!isempty(objVal),
y_est=b1+b2*x;
stderror=sqrt(sum((y-y_est)^2)*inverse(hessian/2)/(nrows(x)-nrows(Estimates)));
);

 

which gives the same std error as the linear regression.

 

View solution in original post

1 REPLY 1
ragnarl
Level II

Re: How to compute the parameter std error (or standard deviation) from the Hessian returned by the Minimize() function?

A colleague helped me figure out what was wrong. 

The calculation of the standard error is incorrect. It should be:

{objVal, iters, gradient, hessian} = Minimize( sseExpr, {b1, b2} ,<<showdetails(true));
if(!isempty(objVal),
y_est=b1+b2*x;
stderror=sqrt(sum((y-y_est)^2)*inverse(hessian/2)/(nrows(x)-nrows(Estimates)));
);

 

which gives the same std error as the linear regression.

 

Recommended Articles