cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Try the Materials Informatics Toolkit, which is designed to easily handle SMILES data. This and other helpful add-ins are available in the JMP® Marketplace
%3CLINGO-SUB%20id%3D%22lingo-sub-615040%22%20slang%3D%22en-US%22%20mode%3D%22NONE%22%3E%E5%9B%9E%E5%A4%8D%EF%BC%9A%E9%80%9A%E8%BF%87%E7%A7%AF%E5%88%86%E8%AE%A1%E7%AE%97%E6%9B%B2%E7%BA%BF%E4%B8%8B%E9%9D%A2%E7%A7%AF%EF%BC%8C%E7%84%B6%E5%90%8E%E5%B0%86%E7%BB%93%E6%9E%9C%E5%A1%AB%E5%85%85%E5%88%B0%E6%96%B0%E5%88%97%E4%B8%AD%E3%80%82%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-615040%22%20slang%3D%22en-US%22%20mode%3D%22NONE%22%3E%3CP%3E%E5%B0%9D%E8%AF%95%E6%A3%80%E6%9F%A5%20JMP%20%E7%94%9F%E6%88%90%E7%9A%84%E5%85%AC%E5%BC%8F%E7%9C%8B%E8%B5%B7%E6%9D%A5%E5%A6%82%E4%BD%95%EF%BC%8C%E5%AE%83%E5%BE%88%E5%8F%AF%E8%83%BD%E4%BC%9A%E7%94%A8%20%3Atime%20%E6%9B%BF%E6%8D%A2%E6%82%A8%E7%9A%84%E6%97%B6%E9%97%B4%EF%BC%8C%E5%9B%A0%E6%AD%A4%E5%AF%B9%E5%8F%98%E9%87%8F%E5%92%8C%E5%86%85%E9%83%A8%E8%A1%A8%E8%BE%BE%E5%BC%8F%E4%BD%BF%E7%94%A8%E4%B8%8E%E6%95%B0%E6%8D%AE%E8%A1%A8%E4%B8%AD%E7%9A%84%E5%88%97%E4%B8%8D%E5%90%8C%E7%9A%84%E5%90%8D%E7%A7%B0%EF%BC%88%E5%B9%B6%E5%8F%AF%E8%83%BD%E5%B0%86%E5%85%B6%E5%8C%85%E8%A3%85%E5%9C%A8%20As%20Constant()%20%E4%B8%AD%EF%BC%89%3C%2FP%3E%0A%3CPRE%3E%3CCODE%20class%3D%22%20language-jsl%22%3EAs%20Constant(%0A%20resp%20%3D%20Expr(a%20*%20a)%3B%0A%20area%20%3D%20Integrate(resp%2C%20a%2C%20Col%20Min(%3Atime)%2C%20Col%20Max(%3Atime))%3B%0A)%3C%2FCODE%3E%3C%2FPRE%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-615213%22%20slang%3D%22en-US%22%20mode%3D%22NONE%22%3E%E5%9B%9E%E5%A4%8D%EF%BC%9A%E9%80%9A%E8%BF%87%E7%A7%AF%E5%88%86%E8%AE%A1%E7%AE%97%E6%9B%B2%E7%BA%BF%E4%B8%8B%E9%9D%A2%E7%A7%AF%EF%BC%8C%E7%84%B6%E5%90%8E%E5%B0%86%E7%BB%93%E6%9E%9C%E5%A1%AB%E5%85%85%E5%88%B0%E6%96%B0%E5%88%97%E4%B8%AD%E3%80%82%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-615213%22%20slang%3D%22en-US%22%20mode%3D%22NONE%22%3E%3CP%3E%E5%A6%82%E6%9E%9C%20Integrate%20%E4%BD%BF%E7%94%A8%E7%9A%84%E8%A1%A8%E8%BE%BE%E5%BC%8F%E9%9C%80%E8%A6%81%E4%BB%8E%E5%88%97%E4%B8%AD%E7%9A%84%E5%85%AC%E5%BC%8F%E4%B8%AD%E6%8F%90%E5%8F%96%EF%BC%8C%E4%BE%8B%E5%A6%82%E4%BD%BF%E7%94%A8%E5%A4%9A%E9%A1%B9%E5%BC%8F%E6%8B%9F%E5%90%88%E4%B8%AD%E7%9A%84%E5%85%AC%E5%BC%8F%E8%BF%9B%E8%A1%8C%20Integrate%EF%BC%8C%E8%AF%A5%E6%80%8E%E4%B9%88%E5%8A%9E%E3%80%82%3C%2FP%3E%3CP%3E%E5%9C%A8%E4%B8%8B%E8%A1%A8%E4%B8%AD%EF%BC%8C%E9%A2%84%E6%B5%8B%E5%99%A8%E5%88%97%E4%B8%AD%E7%9A%84%E5%85%AC%E5%BC%8F%E5%B0%86%E4%BD%BF%E7%94%A8%20%3Atime%20%E5%92%8C%20%3Aresponse%E3%80%82%20%E6%9C%89%E6%B2%A1%E6%9C%89%E4%B8%80%E7%A7%8D%E5%BF%AB%E9%80%9F%E8%AF%AD%E6%B3%95%E5%8F%AF%E4%BB%A5%E7%94%A8%E6%96%B0%E5%8F%98%E9%87%8F%E6%9B%BF%E6%8D%A2%E5%88%97%E5%90%8D%EF%BC%9F%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22GroupSquareWolf_0-1679436129378.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22GroupSquareWolf_0-1679436129378.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22GroupSquareWolf_0-1679436129378.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22GroupSquareWolf_0-1679436129378.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22GroupSquareWolf_0-1679436129378.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22GroupSquareWolf_0-1679436129378.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22GroupSquareWolf_0-1679436129378.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22GroupSquareWolf_0-1679436129378.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22GroupSquareWolf_0-1679436129378.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22GroupSquareWolf_0-1679436129378.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22GroupSquareWolf_0-1679436129378.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22GroupSquareWolf_0-1679436129378.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22GroupSquareWolf_0-1679436129378.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22GroupSquareWolf_0-1679436129378.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22GroupSquareWolf_0-1679436129378.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3Cspan%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22GroupSquareWolf_0-1679436129378.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3Cimg%20src%3D%22https%3A%2F%2Fcommunity.jmp.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F51369iE64A7D6BF48830D5%2Fimage-size%2Fmedium%3Fv%3Dv2%26amp%3Bpx%3D400%22%20role%3D%22button%22%20title%3D%22GroupSquareWolf_0-1679436129378.png%22%20alt%3D%22GroupSquareWolf_0-1679436129378.png%22%20%2F%3E%3C%2Fspan%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-615282%22%20slang%3D%22en-US%22%20mode%3D%22NONE%22%3E%E5%9B%9E%E5%A4%8D%EF%BC%9A%E9%80%9A%E8%BF%87%E7%A7%AF%E5%88%86%E8%AE%A1%E7%AE%97%E6%9B%B2%E7%BA%BF%E4%B8%8B%E9%9D%A2%E7%A7%AF%EF%BC%8C%E7%84%B6%E5%90%8E%E5%B0%86%E7%BB%93%E6%9E%9C%E5%A1%AB%E5%85%85%E5%88%B0%E6%96%B0%E5%88%97%E4%B8%AD%E3%80%82%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-615282%22%20slang%3D%22en-US%22%20mode%3D%22NONE%22%3E%3CP%3E%E5%A6%82%E6%9E%9C%E6%82%A8%E5%8F%AA%E6%83%B3%E5%B0%86%E7%9B%B8%E5%90%8C%E7%9A%84%E5%80%BC%E5%A4%8D%E5%88%B6%E5%88%B0%E6%AF%8F%E4%B8%80%E8%A1%8C%EF%BC%8C%E6%88%91%E4%B8%8D%E4%BC%9A%E4%BD%BF%E7%94%A8%E5%85%AC%E5%BC%8F%EF%BC%88%E5%9C%A8%E5%A4%A7%E5%A4%9A%E6%95%B0%E6%83%85%E5%86%B5%E4%B8%8B%EF%BC%8C%E5%9C%A8%E8%BF%99%E7%A7%8D%E6%83%85%E5%86%B5%E4%B8%8B%E6%9C%80%E5%A5%BD%E4%BD%BF%E7%94%A8%20%26lt%3B%26lt%3B%20Set%20Each%20Value%EF%BC%89%E3%80%82%3C%2FP%3E%0A%3CP%3E%E6%88%91%E4%B8%8D%E7%A1%AE%E5%AE%9A%E6%98%AF%E5%90%A6%E6%9C%89%E4%BB%BB%E4%BD%95%E5%BF%AB%E9%80%9F%E8%AF%AD%E6%B3%95%E5%8F%AF%E4%BB%A5%E7%94%A8%E6%96%B0%E5%8F%98%E9%87%8F%E6%9B%BF%E6%8D%A2%E5%88%97%E5%90%8D%EF%BC%8C%E4%BD%86%20char%2Bsubstitute%2Bparse%2Bexpressions%20%E6%98%AF%E4%B8%80%E7%A7%8D%E9%80%89%E6%8B%A9%3C%2FP%3E%0A%3CPRE%3E%3CCODE%20class%3D%22%20language-jsl%22%3ENames%20Default%20To%20Here(1)%3B%0A%0Adt%20%3D%20New%20Table(%22Untitled%22%2C%0A%20Add%20Rows(4)%2C%0A%20Compress%20File%20When%20Saved(1)%2C%0A%20New%20Column(%22t%22%2C%20Numeric%2C%20%22Continuous%22%2C%20Format(%22Best%22%2C%2012)%2C%20Set%20Values(%5B1%2C%202%2C%203%2C%204%5D))%2C%0A%20New%20Column(%22r%22%2C%20Numeric%2C%20%22Continuous%22%2C%20Format(%22Best%22%2C%2012)%2C%20Formula(%3At%20%5E%202))%0A)%3B%0A%0Adt%20%26lt%3B%26lt%3B%20New%20Column(%22i%22%2C%20Numeric%2C%20Continuous%2C%20%26lt%3B%26lt%3B%20Set%20Each%20Value(%0A%20f%20%3D%20Eval%20Expr(Expr(Parse(Substitute(Char(Column(dt%2C%20%22r%22)%20%26lt%3B%26lt%3B%20get%20formula)%2C%20%22%3A%22%2C%20%22%22))))%3B%0A%20Integrate(f%2C%20t%2C%20Col%20Min(%3At)%2C%20Col%20Max(%3At))%3B%0A))%3B%3C%2FCODE%3E%3C%2FPRE%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-615023%22%20slang%3D%22en-US%22%20mode%3D%22NONE%22%3E%E9%80%9A%E8%BF%87%E7%A7%AF%E5%88%86%E8%AE%A1%E7%AE%97%E6%9B%B2%E7%BA%BF%E4%B8%8B%E9%9D%A2%E7%A7%AF%EF%BC%8C%E7%84%B6%E5%90%8E%E5%B0%86%E7%BB%93%E6%9E%9C%E5%A1%AB%E5%85%85%E5%88%B0%E6%96%B0%E5%88%97%E4%B8%AD%E3%80%82%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-615023%22%20slang%3D%22en-US%22%20mode%3D%22NONE%22%3E%3CP%3E%E5%9C%A8%E6%AD%A4%E7%A4%BA%E4%BE%8B%E6%95%B0%E6%8D%AE%E8%A1%A8%E4%B8%AD%EF%BC%8C%E5%93%8D%E5%BA%94%E7%94%B1%E5%85%AC%E5%BC%8F%E5%AE%9A%E4%B9%89%EF%BC%9A%E5%93%8D%E5%BA%94%20%3D%20%E6%97%B6%E9%97%B4*%E6%97%B6%E9%97%B4%3C%2FP%3E%3CP%3E%E6%88%91%E6%83%B3%E9%80%9A%E8%BF%87%E4%BD%BF%E7%94%A8%E5%93%8D%E5%BA%94%E5%88%97%E4%B8%AD%E5%AE%9A%E4%B9%89%E7%9A%84%E5%85%AC%E5%BC%8F%E5%92%8C%20%3Atime%20%E5%88%97%E4%B8%AD%E5%AE%9A%E4%B9%89%E7%9A%84%E6%97%B6%E9%97%B4%E8%8C%83%E5%9B%B4%E8%BF%9B%E8%A1%8C%E7%A7%AF%E5%88%86%E6%9D%A5%E8%AE%A1%E7%AE%97%E2%80%9C%E6%9B%B2%E7%BA%BF%E4%B8%8B%E9%9D%A2%E7%A7%AF%E2%80%9D(AUC)%EF%BC%8C%E7%84%B6%E5%90%8E%E5%B0%86%E7%BB%93%E6%9E%9C%E5%A1%AB%E5%85%85%E5%88%B0%E6%95%B0%E6%8D%AE%E8%A1%A8%E4%B8%AD%E7%9A%84%E6%96%B0%E5%88%97%E4%B8%AD%EF%BC%88%E9%80%9A%E8%BF%87%E2%80%9C%E5%A1%AB%E5%85%85%E2%80%9C%E6%88%91%E7%9A%84%E6%84%8F%E6%80%9D%E6%98%AF%E6%89%80%E6%9C%89%E8%A1%8C%E9%83%BD%E6%9C%89%E8%AE%A1%E7%AE%97%E5%87%BA%E7%9A%84%20AUC%20%E5%80%BC%EF%BC%89%E3%80%82%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%E6%88%91%E7%9F%A5%E9%81%93%E6%88%91%E5%8F%AF%E4%BB%A5%E4%BD%BF%E7%94%A8%E4%B8%8B%E9%9D%A2%E7%9A%84%E8%84%9A%E6%9C%AC%E6%9D%A5%E8%AE%A1%E7%AE%97AUC%EF%BC%8C%E9%9D%A2%E7%A7%AF%E7%9A%84%E7%BB%93%E6%9E%9C%E6%98%AF41333%E3%80%82%3C%2FP%3E%3CPRE%3E%3CCODE%20class%3D%22%20language-jsl%22%3Eresp%20%3D%20Expr%20(time%20*%20time)%3B%0A%0Aarea%20%3D%20Integrate%20(resp%2C%20time%2C%2010%2C%2050)%3B%0A%0Ashow%20(area)%3B%3C%2FCODE%3E%3C%2FPRE%3E%3CP%3E%E4%BD%86%E6%98%AF%EF%BC%8C%E5%BD%93%E6%88%91%E5%B0%9D%E8%AF%95%E5%A1%AB%E5%85%85%20AUC%20%E7%BB%93%E6%9E%9C%E6%97%B6%EF%BC%88%E6%89%80%E6%9C%89%E8%A1%8C%E7%9A%84%E5%80%BC%E4%B8%BA%2041333%EF%BC%89%3CSPAN%3E%E5%9C%A8%EF%BC%9A%E6%95%B4%E5%90%88%E5%88%97%E4%B8%AD%3C%2FSPAN%3E%3CSPAN%3E%E9%80%9A%E8%BF%87%E4%BD%BF%E7%94%A8%E5%85%AC%E5%BC%8F%EF%BC%9A%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%E7%A7%AF%E5%88%86%EF%BC%88%EF%BC%9A%E5%93%8D%E5%BA%94%EF%BC%8C%EF%BC%9A%E6%97%B6%E9%97%B4%EF%BC%8C%E5%88%97%E6%9C%80%E5%A4%A7%E5%80%BC%EF%BC%88%EF%BC%9A%E6%97%B6%E9%97%B4%EF%BC%89%EF%BC%8C%E5%88%97%E6%9C%80%E5%B0%8F%E5%80%BC%EF%BC%88%EF%BC%9A%E6%97%B6%E9%97%B4%EF%BC%89%EF%BC%89%3C%2FP%3E%3CP%3E%E8%AF%A5%E5%85%AC%E5%BC%8F%E4%B8%8D%E6%98%AF%E5%A1%AB%E5%85%85%E7%BB%93%E6%9E%9C%2041333%20%EF%BC%8C%E8%80%8C%E6%98%AF%E6%A0%B9%E6%8D%AE%E6%AF%8F%E8%A1%8C%E4%B8%AD%20%3A%20time%20%E7%9A%84%E5%AE%9A%E4%B9%89%E5%80%BC%E8%AE%A1%E7%AE%97%E7%BB%93%E6%9E%9C%E3%80%82%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%E7%BC%96%E5%86%99%E5%85%AC%E5%BC%8F%E4%BB%A5%E4%BE%BF%20%3AIntegrate%20%E5%88%97%E5%A1%AB%E5%85%85%E7%BB%93%E6%9E%9C%2041333%20%E7%9A%84%E6%AD%A3%E7%A1%AE%E6%96%B9%E6%B3%95%E6%98%AF%E4%BB%80%E4%B9%88%EF%BC%9F%3C%2FP%3E%3CP%3E%E6%88%91%E7%9F%A5%E9%81%93%E6%88%91%E5%8F%AF%E4%BB%A5%E4%BD%BF%E7%94%A8%20JSL%20%E5%88%9B%E5%BB%BA%E4%B8%80%E4%B8%AA%E6%96%B0%E7%9A%84%E6%95%B0%E6%8D%AE%E8%A1%A8%EF%BC%8C%E7%84%B6%E5%90%8E%E5%8A%A0%E5%85%A5%E7%BB%93%E6%9E%9C%EF%BC%8C%E4%BD%86%E6%9B%B4%E6%84%BF%E6%84%8F%E5%9C%A8%E5%90%8C%E4%B8%80%E4%B8%AA%E6%95%B0%E6%8D%AE%E8%A1%A8%E4%B8%AD%E6%89%A7%E8%A1%8C%E6%AD%A4%E6%93%8D%E4%BD%9C%E3%80%82%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%E8%B0%A2%E8%B0%A2%EF%BC%81%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22GroupSquareWolf_0-1679416641928.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22GroupSquareWolf_0-1679416641928.png%22%20style%3D%22width%3A%20293px%3B%22%3E%3Cspan%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22GroupSquareWolf_0-1679416641928.png%22%20style%3D%22width%3A%20293px%3B%22%3E%3Cimg%20src%3D%22https%3A%2F%2Fcommunity.jmp.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F51343i47B15125FBF81FE5%2Fimage-size%2Fmedium%3Fv%3Dv2%26amp%3Bpx%3D400%22%20role%3D%22button%22%20title%3D%22GroupSquareWolf_0-1679416641928.png%22%20alt%3D%22GroupSquareWolf_0-1679416641928.png%22%20%2F%3E%3C%2Fspan%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-615023%22%20slang%3D%22en-US%22%20mode%3D%22NONE%22%3E%3CLINGO-LABEL%3E%E8%87%AA%E5%8A%A8%E5%8C%96%E5%92%8C%E8%84%9A%E6%9C%AC%E7%BC%96%E5%86%99%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E
Choose Language Hide Translation Bar
GroupSquareWolf
Level III

calculate area under the curve by integration then populate the result in a new column.

In this example datatable, response is defined by fomula:  response = time*time

I would like to calculate "area under the curve" (AUC) by integration using the fomula defined in the response column and the time range defined in the :time column, then populate the result in a new column in the datatable (by "populate" I mean all rows have the value of the calculated AUC).

 

I know I can use the following script to calculate the AUC, and the result of area is 41333.

resp = Expr (time * time);

area = Integrate (resp, time, 10, 50);

show (area);

However, when I tried to populate the AUC result (all rows have the value of 41333) in the :Integrate column by using formula: 

      Integrate( :response, :time, Col Maximum( :time ), Col Minimum( :time ) )

instead of populating the result 41333 , the formula calculated the result based on the defined value of : time in each row. 

 

What is the correct way to write the formula so that the :Integrate column is populated with the result 41333?

I know I could use JSL to create a new datatable and then join the result but would prefer to do this within the same datatable.

 

Thanks!

 

GroupSquareWolf_0-1679416641928.png

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
jthi
Super User

Re: calculate area under the curve by integration then populate the result in a new column.

I wouldn't use formulas if you just want to replicate same value to each row (in most cases it is better to use << Set Each Value in cases like this).

I'm not sure if there is any quick syntax to replace column names with new variables, but char+substitute+parse+expressions is one option

Names Default To Here(1);

dt = New Table("Untitled",
	Add Rows(4),
	Compress File When Saved(1),
	New Column("t", Numeric, "Continuous", Format("Best", 12), Set Values([1, 2, 3, 4])),
	New Column("r", Numeric, "Continuous", Format("Best", 12), Formula(:t ^ 2))
);

dt << New Column("i", Numeric, Continuous, << Set Each Value(
	f = Eval Expr(Expr(Parse(Substitute(Char(Column(dt, "r") << get formula), ":", ""))));
	Integrate(f, t, Col Min(:t), Col Max(:t));
));
-Jarmo

View solution in original post

3 REPLIES 3
jthi
Super User

Re: calculate area under the curve by integration then populate the result in a new column.

Try checking out how the formula JMP generates does look like, it will most likely replace your time with :time so use different name for the variable and inside expression than columns in your data table (and possibly wrap it inside As Constant())

As Constant(
	resp = Expr(a * a);
	area = Integrate(resp, a, Col Min(:time), Col Max(:time));
)
-Jarmo
GroupSquareWolf
Level III

Re: calculate area under the curve by integration then populate the result in a new column.

What if the expression used by Integrate needs to be extracted from the formula in a column, for example to Integrate using a formula from a polynomial fit.

In the table below, the formula in the predictor column would use  :time and :response. Is there a quick syntax to replace the column names with new variables?

 

GroupSquareWolf_0-1679436129378.png

 

jthi
Super User

Re: calculate area under the curve by integration then populate the result in a new column.

I wouldn't use formulas if you just want to replicate same value to each row (in most cases it is better to use << Set Each Value in cases like this).

I'm not sure if there is any quick syntax to replace column names with new variables, but char+substitute+parse+expressions is one option

Names Default To Here(1);

dt = New Table("Untitled",
	Add Rows(4),
	Compress File When Saved(1),
	New Column("t", Numeric, "Continuous", Format("Best", 12), Set Values([1, 2, 3, 4])),
	New Column("r", Numeric, "Continuous", Format("Best", 12), Formula(:t ^ 2))
);

dt << New Column("i", Numeric, Continuous, << Set Each Value(
	f = Eval Expr(Expr(Parse(Substitute(Char(Column(dt, "r") << get formula), ":", ""))));
	Integrate(f, t, Col Min(:t), Col Max(:t));
));
-Jarmo