cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Submit your abstract to the call for content for Discovery Summit Americas by April 23. Selected abstracts will be presented at Discovery Summit, Oct. 21- 24.
Discovery is online this week, April 16 and 18. Join us for these exciting interactive sessions.
Choose Language Hide Translation Bar
Knekse
Level II

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
ian_jmp
Staff

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.

View solution in original post

4 REPLIES 4
txnelson
Super User

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
Knekse
Level II

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

ian_jmp
Staff

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.

Knekse
Level II

Re: Random Normal Mixture vector input

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