Community Trekker

Joined:

Aug 10, 2016

## Random Normal Mixture vector input

Hi

I have been trying to write a formula for a column, using Random Normal Mixture(meanvec, sdvec, probvec). I would like to use Table variables as the input. How do I go about this? Do I define the table variables as vectors or can i make a vector of single table variables in the formula editor?

Thank you for any clues or help

1 ACCEPTED SOLUTION

Accepted Solutions

Staff

Joined:

Jun 23, 2011

Solution

## Re: Random Normal Mixture vector input

I think Jim was just using the script above as a convenient way to generate the table with the required properties and formula. But the script is not required. Please see the attached.

4 REPLIES

Super User

Joined:

Jun 22, 2012

## Re: Random Normal Mixture vector input

Here is an example script that uses table variables as input to a Random Normal Mixture formula:

Names Default To Here( 1 );

dt = New Table( "Example" );

mv = [-3, 3];

sv = [1, 1];

pv = [.3, .7];

// All table variables are actually character strings

// so the matrices need to be saved as literals

dt << New Table Variable( "meanvec", Char( mv ) );

dt << New Table Variable( "sdvec", Char( sv ) );

dt << New Table Variable( "probvec", Char( pv ) );

dt << New Column( "Rand NM",

set formula( Random Normal Mixture(

Parse( dt:meanvec ),

Parse( dt:sdvec ),

Parse( dt:probvec ) ) )

);

dt << add rows( 1000 );

Jim

Community Trekker

Joined:

Aug 10, 2016

## Re: Random Normal Mixture vector input

Hi Jim

Thank you very much for the answer. I was actually looking for a solution for how to do it in the formula editor in a table, ie. without scripting. Do you know how that can be done?

Best regards

Jeppe

Staff

Joined:

Jun 23, 2011

Solution

## Re: Random Normal Mixture vector input

I think Jim was just using the script above as a convenient way to generate the table with the required properties and formula. But the script is not required. Please see the attached.

Community Trekker

Joined:

Aug 10, 2016

## Re: Random Normal Mixture vector input

Thank you Ian... I was missing the Parse()​ function in there... Now I got it to work