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-87647%22%20slang%3D%22en-US%22%20mode%3D%22NONE%22%3E%E7%A7%BB%E5%8B%95%E5%B9%B3%E5%9D%87%E7%B7%9A%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-87647%22%20slang%3D%22en-US%22%20mode%3D%22NONE%22%3E%3CP%3E%E6%88%91%E6%9C%89%E4%B8%80%E5%80%8B%E5%90%8D%E7%82%BA%E2%80%9C%E8%97%A5%E7%89%A9%E2%80%9D%E7%9A%84%E8%A1%A8%EF%BC%8C%E5%85%B6%E4%B8%AD%E5%8C%85%E5%90%AB%E2%80%9C%E8%97%A5%E7%89%A9%E2%80%9D%E5%92%8C%E2%80%9C%E7%B5%90%E6%9E%9C%E2%80%9D%E5%88%97%EF%BC%8C%E5%A6%82%E4%BD%95%E9%80%9A%E9%81%8E%E5%8F%96%E5%89%8D%204%20%E8%A1%8C%E5%92%8C%E6%8E%A5%E4%B8%8B%E4%BE%86%E7%9A%84%204%20%E8%A1%8C%E4%B8%A6%E9%A1%9E%E4%BC%BC%E5%9C%B0%E7%B9%BC%E7%BA%8C%E4%BE%86%E8%A8%88%E7%AE%97%E7%B5%90%E6%9E%9C%E5%88%97%E7%9A%84%E7%A7%BB%E5%8B%95%E5%B9%B3%E5%9D%87%E5%80%BC%E3%80%82%20Pfa%20%E7%A4%BA%E4%BE%8B%E8%A1%A8%E4%BE%9B%E5%8F%83%E8%80%83%E3%80%82%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-532174%22%20slang%3D%22en-US%22%20mode%3D%22NONE%22%3E%E5%9B%9E%E5%A4%8D%EF%BC%9A%E7%A7%BB%E5%8B%95%E5%B9%B3%E5%9D%87%E7%B7%9A%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-532174%22%20slang%3D%22en-US%22%20mode%3D%22NONE%22%3E%3CP%3EJMP%20%E7%9A%84%E6%94%AF%E6%8C%81%E6%96%87%E6%AA%94%E6%8F%90%E4%BE%9B%E4%BA%86%E6%9C%89%E9%97%9C%E5%A6%82%E4%BD%95%E5%AE%9A%E7%BE%A9%E5%85%AC%E5%BC%8F%E7%9A%84%E4%B8%80%E4%BA%9B%E9%A1%8D%E5%A4%96%E8%83%8C%E6%99%AF%EF%BC%88%E5%AE%9A%E7%BE%A9%E5%8F%83%E6%95%B8%EF%BC%8C%E9%82%84%E5%8C%85%E6%8B%AC%E4%B8%80%E4%BA%9B%E4%B8%8D%E9%8C%AF%E7%9A%84%E5%B0%8F%E7%A4%BA%E4%BE%8B%EF%BC%89%EF%BC%9A%3CA%20href%3D%22https%3A%2F%2Fwww.jmp.com%2Fsupport%2Fhelp%2Fen%2F16.2%2F%23page%2Fjmp%2Fstatistical-functions-2.shtml%23%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%22%3E%20https%3A%2F%2Fwww.jmp.com%2Fsupport%2Fhelp%2Fen%2F16.2%2F%23page%2Fjmp%2Fstatistical-functions-2.shtml%23%3C%2FA%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22PatrickGiuliano_0-1660093800183.png%22%20style%3D%22width%3A%20999px%3B%22%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22PatrickGiuliano_0-1660093800183.png%22%20style%3D%22width%3A%20999px%3B%22%3E%3Cspan%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22PatrickGiuliano_0-1660093800183.png%22%20style%3D%22width%3A%20999px%3B%22%3E%3Cimg%20src%3D%22https%3A%2F%2Fcommunity.jmp.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F44691i32DEE1055F339075%2Fimage-size%2Flarge%3Fv%3Dv2%26amp%3Bpx%3D999%22%20role%3D%22button%22%20title%3D%22PatrickGiuliano_0-1660093800183.png%22%20alt%3D%22PatrickGiuliano_0-1660093800183.png%22%20%2F%3E%3C%2Fspan%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%E4%BD%A0%E5%8F%AF%E4%BB%A5%E5%9C%A8%E7%B6%AD%E5%9F%BA%E7%99%BE%E7%A7%91%E4%B8%AD%E6%89%BE%E5%88%B0%EF%BC%88%3CA%20href%3D%22https%3A%2F%2Fen.wikipedia.org%2Fwiki%2FMoving_average%22%20target%3D%22_blank%22%20rel%3D%22nofollow%20noopener%20noreferrer%22%3E%20https%3A%2F%2Fen.wikipedia.org%2Fwiki%2FMoving_average%EF%BC%89%3C%2FA%3E%E6%9B%B4%E5%A4%9A%E9%97%9C%E6%96%BC%E7%A7%BB%E5%8B%95%E5%B9%B3%E5%9D%87%E7%B7%9A%E8%A8%88%E7%AE%97%E8%83%8C%E5%BE%8C%E7%9A%84%E5%9F%BA%E6%9C%AC%E5%8E%9F%E7%90%86%E5%92%8C%E6%95%B8%E5%AD%B8%2F%E6%A6%82%E5%BF%B5%E7%90%86%E8%A7%A3%EF%BC%9A%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-105084%22%20slang%3D%22en-US%22%20mode%3D%22NONE%22%3E%E5%9B%9E%E5%A4%8D%EF%BC%9A%E7%A7%BB%E5%8B%95%E5%B9%B3%E5%9D%87%E7%B7%9A%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-105084%22%20slang%3D%22en-US%22%20mode%3D%22NONE%22%3E%E8%AC%9D%E8%AC%9D%E9%80%99%E6%9C%89%E6%95%88%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-105083%22%20slang%3D%22en-US%22%20mode%3D%22NONE%22%3E%E5%9B%9E%E5%A4%8D%EF%BC%9A%E7%A7%BB%E5%8B%95%E5%B9%B3%E5%9D%87%E7%B7%9A%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-105083%22%20slang%3D%22en-US%22%20mode%3D%22NONE%22%3E%E5%8A%A0%E6%AC%8A%3D%201%EF%BC%8C%E4%B9%8B%E5%89%8D%3D%203%EF%BC%8C%EF%BC%9A%E8%97%A5%E7%89%A9%E6%98%AF%E4%BB%80%E9%BA%BC%E6%84%8F%E6%80%9D%EF%BC%9F%3CBR%20%2F%3E%E4%BD%A0%E8%83%BD%E8%A7%A3%E9%87%8B%E4%B8%80%E4%B8%8B%E9%80%99%E5%80%8B%E5%85%AC%E5%BC%8F%E5%97%8E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-105082%22%20slang%3D%22en-US%22%20mode%3D%22NONE%22%3E%E5%9B%9E%E5%A4%8D%EF%BC%9A%E7%A7%BB%E5%8B%95%E5%B9%B3%E5%9D%87%E7%B7%9A%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-105082%22%20slang%3D%22en-US%22%20mode%3D%22NONE%22%3E%E9%80%99%E4%B8%8D%E8%B5%B7%E4%BD%9C%E7%94%A8%3CBR%20%2F%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-88024%22%20slang%3D%22en-US%22%20mode%3D%22NONE%22%3E%E5%9B%9E%E5%A4%8D%EF%BC%9A%E7%A7%BB%E5%8B%95%E5%B9%B3%E5%9D%87%E7%B7%9A%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-88024%22%20slang%3D%22en-US%22%20mode%3D%22NONE%22%3E%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22Moving%20average%20dialog.png%22%20style%3D%22width%3A%20373px%3B%22%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22Moving%20average%20dialog.png%22%20style%3D%22width%3A%20373px%3B%22%3E%3Cspan%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22Moving%20average%20dialog.png%22%20style%3D%22width%3A%20373px%3B%22%3E%3Cimg%20src%3D%22https%3A%2F%2Fcommunity.jmp.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F15002i2532FCBB9DB58BDE%2Fimage-size%2Flarge%3Fv%3Dv2%26amp%3Bpx%3D999%22%20role%3D%22button%22%20title%3D%22Moving%20average%20dialog.png%22%20alt%3D%22Moving%20average%20dialog.png%22%20%2F%3E%3C%2Fspan%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%E6%88%91%E8%AA%8D%E7%82%BA%E9%80%99%E5%B0%87%E7%82%BA%E6%82%A8%E6%8F%90%E4%BE%9B%E6%89%80%E9%9C%80%E7%9A%84%E7%A7%BB%E5%8B%95%E5%B9%B3%E5%9D%87%E5%80%BC%EF%BC%88%E4%B9%8B%E5%89%8D%204%20%E8%A1%8C%EF%BC%8C%E4%B9%8B%E5%BE%8C%204%20%E8%A1%8C%EF%BC%89%E3%80%82%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-87746%22%20slang%3D%22en-US%22%20mode%3D%22NONE%22%3E%E5%9B%9E%E5%A4%8D%EF%BC%9A%E7%A7%BB%E5%8B%95%E5%B9%B3%E5%9D%87%E7%B7%9A%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-87746%22%20slang%3D%22en-US%22%20mode%3D%22NONE%22%3E%3CP%3E%E4%BD%BF%E7%94%A8%E7%9A%84%E5%85%AC%E5%BC%8F%E6%98%AF%3C%2FP%3E%0A%3CPRE%3E%3CCODE%20class%3D%22%20language-jsl%22%3EIf(%20Mod(%20Row()%2C%204%20)%20%3D%3D%200%2C%0A%20Mean(%20%3AResult%5BIndex(%20Row()%20-%203%2C%20Row()%20)%5D%20)%0A)%3C%2FCODE%3E%3C%2FPRE%3E%0A%3CP%3E%E6%88%91%E5%B7%B2%E9%99%84%E4%B8%8A%E6%82%A8%E7%9A%84%E7%A4%BA%E4%BE%8B%E6%95%B8%E6%93%9A%E8%A1%A8%EF%BC%8C%E5%85%B6%E4%B8%AD%E6%9C%89%E4%B8%80%E5%80%8B%E6%96%B0%E5%88%97%EF%BC%8C%E5%85%B6%E4%B8%AD%E5%8C%85%E5%90%AB%E5%85%AC%E5%BC%8F%3C%2FP%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22drugs.PNG%22%20style%3D%22width%3A%20512px%3B%22%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22drugs.PNG%22%20style%3D%22width%3A%20512px%3B%22%3E%3Cspan%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22drugs.PNG%22%20style%3D%22width%3A%20512px%3B%22%3E%3Cimg%20src%3D%22https%3A%2F%2Fcommunity.jmp.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F15001i63F40F710CA32DDB%2Fimage-size%2Flarge%3Fv%3Dv2%26amp%3Bpx%3D999%22%20role%3D%22button%22%20title%3D%22drugs.PNG%22%20alt%3D%22drugs.PNG%22%20%2F%3E%3C%2Fspan%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-87744%22%20slang%3D%22en-US%22%20mode%3D%22NONE%22%3E%E5%9B%9E%E5%A4%8D%EF%BC%9A%E7%A7%BB%E5%8B%95%E5%B9%B3%E5%9D%87%E7%B7%9A%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-87744%22%20slang%3D%22en-US%22%20mode%3D%22NONE%22%3E%3CP%3E%E6%88%91%E6%83%B3%E7%94%9F%E6%88%90%E7%A7%BB%E5%8B%95%E5%B9%B3%E5%9D%87%E5%88%97%EF%BC%8C%E5%A6%82%E9%99%84%E8%A1%A8%E6%89%80%E7%A4%BA%EF%BC%8C%E6%AF%8F%204%20%E8%A1%8C%E6%88%91%E9%9C%80%E8%A6%81%E8%A8%88%E7%AE%97%E5%B9%B3%E5%9D%87%E5%80%BC%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-87743%22%20slang%3D%22en-US%22%20mode%3D%22NONE%22%3E%E5%9B%9E%E5%A4%8D%EF%BC%9A%E7%A7%BB%E5%8B%95%E5%B9%B3%E5%9D%87%E7%B7%9A%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-87743%22%20slang%3D%22en-US%22%20mode%3D%22NONE%22%3E%E6%82%A8%E7%9A%84%E7%B5%90%E6%9E%9C%E6%98%AF%E5%90%A6%E6%9C%89%204%20%E5%88%97%EF%BC%8C%E6%88%96%E8%80%85%E6%98%AF%E7%A4%BA%E4%BE%8B%E6%95%B8%E6%93%9A%E8%A1%A8%E4%B8%AD%E9%A1%AF%E7%A4%BA%E7%9A%84%E8%A1%8C%E6%95%B8%E7%9A%84%204%20%E5%80%8D%EF%BC%9F%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-87741%22%20slang%3D%22en-US%22%20mode%3D%22NONE%22%3E%E5%9B%9E%E5%A4%8D%EF%BC%9A%E7%A7%BB%E5%8B%95%E5%B9%B3%E5%9D%87%E7%B7%9A%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-87741%22%20slang%3D%22en-US%22%20mode%3D%22NONE%22%3E%E6%82%A8%E8%83%BD%E5%90%A6%E8%A7%A3%E9%87%8B%E4%B8%80%E4%B8%8B%E4%B8%8B%E4%B8%80%E6%AD%A5%EF%BC%8C%E6%88%91%E6%83%B3%E8%A8%88%E7%AE%97%204%20%E5%80%8B%E9%80%A3%E7%BA%8C%E6%A8%A3%E6%9C%AC%E7%9A%84%E5%B9%B3%E5%9D%87%E5%80%BC%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-87662%22%20slang%3D%22en-US%22%20mode%3D%22NONE%22%3E%E5%9B%9E%E5%A4%8D%EF%BC%9A%E7%A7%BB%E5%8B%95%E5%B9%B3%E5%9D%87%E7%B7%9A%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-87662%22%20slang%3D%22en-US%22%20mode%3D%22NONE%22%3E%3CP%3E%E5%9C%A8%E6%95%B8%E6%93%9A%E8%A1%A8%E4%B8%AD%E5%89%B5%E5%BB%BA%E4%B8%80%E5%80%8B%E6%96%B0%E5%88%97%EF%BC%8C%E4%B8%A6%E6%87%89%E7%94%A8%E4%BB%A5%E4%B8%8B%E5%85%AC%E5%BC%8F%3C%2FP%3E%0A%3CPRE%3E%3CCODE%20class%3D%22%20language-jsl%22%3ECol%20Moving%20Average(%20%3AResult%2C%20weighting%20%3D%201%2C%20before%20%3D%203%2C%20%3ADrug%20)%3C%2FCODE%3E%3C%2FPRE%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-87661%22%20slang%3D%22en-US%22%20mode%3D%22NONE%22%3E%E5%9B%9E%E5%A4%8D%EF%BC%9A%E7%A7%BB%E5%8B%95%E5%B9%B3%E5%9D%87%E7%B7%9A%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-87661%22%20slang%3D%22en-US%22%20mode%3D%22NONE%22%3E%3CP%3E%E4%BD%A0%E5%A5%BD%20%EF%BC%8C%3C%2FP%3E%3CP%3E%E6%82%A8%E5%8F%AF%E4%BB%A5%E5%98%97%E8%A9%A6%E4%BD%BF%E7%94%A8%E5%85%AC%E5%BC%8F%E5%88%97%20--%26gt%3B%20%E8%A1%8C%20--%26gt%3B%20%E7%A7%BB%E5%8B%95%E5%B9%B3%E5%9D%87%E5%80%BC%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%22moving.jpg%22%20style%3D%22width%3A%20908px%3B%22%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22moving.jpg%22%20style%3D%22width%3A%20908px%3B%22%3E%3Cspan%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22moving.jpg%22%20style%3D%22width%3A%20908px%3B%22%3E%3Cimg%20src%3D%22https%3A%2F%2Fcommunity.jmp.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F14982i470944843464D147%2Fimage-size%2Flarge%3Fv%3Dv2%26amp%3Bpx%3D999%22%20role%3D%22button%22%20title%3D%22moving.jpg%22%20alt%3D%22moving.jpg%22%20%2F%3E%3C%2Fspan%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FP%3E%3C%2FLINGO-BODY%3E
Choose Language Hide Translation Bar
jojmp
Level III

Moving Average

I have a table called drugs with columns drug and result, how do I calculate the moving average of the result column by taking the first 4 rows followed by the next 4 rows and similarly continue. Pfa the sample table for reference. 

1 ACCEPTED SOLUTION

Accepted Solutions
txnelson
Super User

Re: Moving Average

The formula to use is

If( Mod( Row(), 4 ) == 0,
	Mean( :Result[Index( Row() - 3, Row() )] )
)

I have attached your example data table, with a new column with the formula in it

drugs.PNG

Jim

View solution in original post

11 REPLIES 11
gianpaolo
Level IV

Re: Moving Average

hello ,

you can try with Formula column --> row --> moving average

 

moving.jpg

Gianpaolo Polsinelli
jojmp
Level III

Re: Moving Average

Could you please explain the next step after this, I want to calculate the average of 4 consecutive samples
txnelson
Super User

Re: Moving Average

Do you have 4 columns of results, or 4 times as many rows as you show in your sample data table?
Jim
jojmp
Level III

Re: Moving Average

I want to generate the moving average column as shown in the attached table, for every 4 rows I need to calculate the average

txnelson
Super User

Re: Moving Average

The formula to use is

If( Mod( Row(), 4 ) == 0,
	Mean( :Result[Index( Row() - 3, Row() )] )
)

I have attached your example data table, with a new column with the formula in it

drugs.PNG

Jim
jojmp
Level III

Re: Moving Average

Thanks this worked
Phil_Kay
Staff

Re: Moving Average

Moving average dialog.png

I think this will give you the moving average that you want (4 rows before and 4 rows after).

jojmp
Level III

Re: Moving Average

this did not work
txnelson
Super User

Re: Moving Average

Create a new column in your data table, and apply the folloing formula

Col Moving Average( :Result, weighting = 1, before = 3, :Drug )
Jim