Turn on suggestions

Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.

Showing results for

- JMP User Community
- :
- Discussions
- :
- Writing a JMP formula

Topic Options

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Email to a Friend
- Report Inappropriate Content

Writing a JMP formula

Mar 17, 2018 7:33 PM
(3964 views)

I have a data set from 1985-1996 showing yearly reductions in about 16 different cities. Not all of the cities have complete data sets. I have to find the mean of the yearly difference for each city. The data is listed by month but the numbers only actually change after the last month. There are holes all over the approximately 2000 lines of data. I would be fine if there were no holes, but I'm stumped. Can anyone steer me in the right direction?

- Tags:
- formula

6 REPLIES 6

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Email to a Friend
- Report Inappropriate Content

Re: Writing a JMP formula

I have only a vague idea of what the data table actually looks like.....could you either attach the data table, or a subset of the data table? That would really help in figuring out a solution.

Jim

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Email to a Friend
- Report Inappropriate Content

Re: Writing a JMP formula

Here is an excel version of the data set

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Email to a Friend
- Report Inappropriate Content

Re: Writing a JMP formula

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Email to a Friend
- Report Inappropriate Content

Re: Writing a JMP formula

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Email to a Friend
- Report Inappropriate Content

Re: Writing a JMP formula

The solution is quite simple...just simplify the data down to one row per year/location, and then add a new column with a simple formula and then generate a tabular report. Below is a script that will perform the tasks. The script was generated by performing the tasks required interactively and then having JMP generate the required script for each step in the solution

```
Names Default To Here( 1 );
// Create a handle pointing to the raw data table
dt = Current Data Table();
// Since all of the values for each year are the same,
// summarize the data by year and location to get just one
// row per year/location.......Min, Max, Mean, Median could
// all be used for the statistic, since they would yield
// the same results, with all of the data being the same
dt2 = dt << Summary(
Group(
:Name( "Site of ARB_metals 2 final 2 By (Site, yr)" ),
:Name( "yr of ARB_metals 2 final 2 By (Site, yr)" )
),
Max( :Name( "Mean(log(Pb))" ) ),
Freq( "None" ),
Weight( "None" ),
statistics column name format( "column" )
);
// Add a new column, calculating the difference
dt2 << New Column( "Difference",
formula(
If(
Row() == 1 | Lag( :Name( "Site of ARB_metals 2 final 2 By (Site, yr)" ) ) !=
:Name( "Site of ARB_metals 2 final 2 By (Site, yr)" ),
.,
Lag( :Name( "Mean(log(Pb))" ) ) - :Name( "Mean(log(Pb))" )
)
)
);
// Run the Tabulate Platform to generated the desired table
dt2 << Tabulate(
Show Control Panel( 0 ),
Add Table(
Column Table( Analysis Columns( :Difference ), Statistics( Mean ) ),
Row Table(
Grouping Columns(
:Name( "Site of ARB_metals 2 final 2 By (Site, yr)" )
)
)
)
);
```

I suggest that you read the document "Using JMP" as a good way to start to learn JMP

Help==>Books==>Using JMP

Jim

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Email to a Friend
- Report Inappropriate Content

Re: Writing a JMP formula

The mean of means is simply the mean of the sum of the means.

Here's a website that discusses this: The Mean of Means | CK-12 Foundation - https://www.ck12.org/book/CK-12-Probability-and-Statistics-Concepts/section/9.6/