Subscribe Bookmark RSS Feed

Automating a DoE and fitting the Model

andreasp

Community Trekker

Joined:

Feb 17, 2012

Hi

I'm working on a bit of software attempting to automate JMP 9 in C#, what I'm attempting to do is create a DoE, fill the data table with my results and then fit the model. I can get as far as generating the DoE and filling the datatable but I'm getting stuck at the final stage of fitting the model. My code looks a little like this (part of a larger class with Response, Factor and Term properties) :

JMP.Application jmp = new JMP.Application();           

jmp.Visible = true;

JMP.DOECustom doe = jmp.CreateDOECustom();

foreach (JMPResponse response in this.Responses)

{

    doe.AddResponse(response.ResponseType, response.Name, response.Minimum, response.Maximum, 1);

}

foreach (JMPContinuousFactor factor in this.Factors)

{   

    doe.AddContinuousFactorWithName(factor.Name, factor.Minimum, factor.Maximum);

}

foreach (JMPTerm term in this.Terms)

{

    doe.AddTerms(term.AsIntArray());

}

doe.MakeDesign();

JMP.DataTable dt = doe.MakeTable();

// Do bit's and pieces to fill the table

What I'd like to do next is Fit the model and then (hopefully) extract the various coefficients, t statistics and so on from each of the terms. I can't really find anything obvious in the documentation or the code samples that lets me do this.

Any help appreciated.

2 REPLIES
mpb

Super User

Joined:

Jun 23, 2011

The following pure JSL example may help. This kind of thing is discussed in the Scripting PDF doc under the heading Platform Scripting Notes.

Open( "$SAMPLE_DATA/fitness.jmp" );

fit_model_object = Fit Model(

    Y( :Oxy ),

    Effects( :Age, :Weight, :Runtime, :RunPulse, :RstPulse ),

    Personality( Standard Least Squares ),

    Emphasis( Effect Leverage ),

    Run(

        :Oxy << {Lack of Fit( 0 ), Plot Actual by Predicted( 1 ), Plot Regression( 0 ),

        Plot Residual by Predicted( 1 ), Plot Effect Leverage( 1 )}

    )

);

vc = fit_model_object << Get Variance Components();

effnames = fit_model_object << Get Effect Names();

effpvals = fit_model_object << Get Effect PValues();

ests = fit_model_object << Get Estimates();

parmnames = fit_model_object << Get Parameter Names();

randeffnames = fit_model_object << Get Random Effect Names();

stderr = fit_model_object << Get Std Errors();

fit_model_object << Get X Matrix();

fit_model_object << Get XPX Inverse();

Show( effnames, effpvals, ests, parmnames, stderr );

andreasp

Community Trekker

Joined:

Feb 17, 2012

Thanks for that mpb, suspected that I might have to get down and dirty with JSL. I'll add for the benefit of any future users wandering around these parts that the Automating JMP using C# document has some good information on how to access JSL variables and the like.