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

Showing results for

- JMP User Community
- :
- Discussions
- :
- Discussions
- :
- how to script a new normalized column

- 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
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

Dec 16, 2009 4:27 PM
(1192 views)

Is there an elegant way to normalize values into a new column using the mean of one group? I have dose response data, with a control group (dose==0) and want to create a new column where each measurement is divided by the control group mean. Each dose has multiple measurements. I can use Distribution with Where to output only the control group mean but then I insert manually that mean into the formula for the new column. I tried putting the Where command into the New Column function and it was rejected (too many parameters). Here is my Distribution script:

New Window( "Distribution",

V List Box(

Distribution(

Continuous Distribution(

Column( :Name( "Brain ChE" ) ),

Histogram( 0 ),

Vertical( 1 ),

Outlier Box Plot( 0 )

),

Where( :Name( "Dose mg/kg" ) == 0 )

),

)

);

New Window( "Distribution",

V List Box(

Distribution(

Continuous Distribution(

Column( :Name( "Brain ChE" ) ),

Histogram( 0 ),

Vertical( 1 ),

Outlier Box Plot( 0 )

),

Where( :Name( "Dose mg/kg" ) == 0 )

),

)

);

2 REPLIES

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

Dec 17, 2009 1:37 PM
(1118 views)

Don't know if this is "elegant", but you can manually make a column with a formula to do what you want. Assuming the grouping column which identifies your groups has a "c" for the control group:

:Y / Col Mean(If(:Group == "c", :Y, Empty()))

In scripting you can create a new column and make the new column have this formula. See page 124 of the scripting docs for examples of creating a new column with a formula.

:Y / Col Mean(If(:Group == "c", :Y, Empty()))

In scripting you can create a new column and make the new column have this formula. See page 124 of the scripting docs for examples of creating a new column with a formula.

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

Dec 23, 2009 10:10 PM
(1118 views)

Yes! It is elegant in the math sense of very efficient coding.

For data with numerical values (as I have) for the controls, here is my revision of your one-liner, where dose=0 identifies the control group.

:Brain / Col Mean( If( :dose == 0, :Brain, Empty() ) )

For data with numerical values (as I have) for the controls, here is my revision of your one-liner, where dose=0 identifies the control group.

:Brain / Col Mean( If( :dose == 0, :Brain, Empty() ) )