Dunnett para múltiples YsEstoy tratando de obtener un script que ejecute Dunnett's en múltiples Ys automáticamente en el modelo de ajuste, mis problemas:
Si cambio la parte de comparaciones múltiples donde el factor y el nivel no es una variable, funciona, pero solo para la primera Y, no repetirá la parte de Dunnett para las Y restantes. Entonces mis preguntas:
1. ¿Por qué esto no funciona como el modelo de ajuste con una variable que se utiliza para el factor y el nivel de control de Dunnett?
2. ¿Podemos obtener Dunnett's para múltiples Y automáticamente?
Lisa
Esto es lo que tengo hasta ahora:
Names Default To Here( 1 );
Clear Log();
lbwidth = 130;
Tolerance = .01;
If( Not( Is Scriptable( dt ) ),
// Check that there is a data set open;
//ca=Caption("Please Open Design Data Set", Back Color(yellow));
//Stop();
dtsel = Pick File( "Open File", {"JMP|jmp", "All files|*"} );
If( dtsel == "",
Stop(),
Try( dt = Open( dtsel ), Stop() )
);
);
Dia_Window = Expr(
// Window to get list of factors and response;
Factorws = New Window( "Fit Model With Dunnetts",
show toolbars( 0 ),
Show Menu( 0 ),
Border Box( Left( 3 ), top( 2 ),
V List Box(
H List Box(
Panel Box( "Select Column to be used as the Factor and the Response(s)",
colListData = Col List Box(
All,
width( lbWidth ),
nLines( Min( nc, 10 ) )
)
),
Panel Box( "The Factor",
Lineup Box( N Col( 2 ), Spacing( 3 ),
Button Box( "Factor",
colListW << Append( colListData << GetSelected )
),
colListW = Col List Box(
width( lbWidth ),
nLines( 1 ),
MinItems( 1 )
),
)
),
Panel Box( "The Response(s)",
Lineup Box( N Col( 2 ), Spacing( 3 ),
Button Box( "Response(s)",
colListY << Append( colListData << GetSelected )
),
colListY = Col List Box(
width( lbWidth ),
nLines( 8 ),
MinItems( 1 )
),
)
),
Panel Box( "Action",
Lineup Box( N Col( 1 ),
Button Box( "OK",
nm = colListW << GetItems;
nY = colListY << GetItems;
If( N Items( nm ) > 0,
dm = dt << Get As Matrix( nm );
Factorws << Close Window;
Eval( next );
);
),
Button Box( "Cancel",
Factorws << Close Window;
Stop();
),
Text Box( " " ),
Button Box( "Remove",
colListW << RemoveSelected;
colListY << RemoveSelected;
)
)
)
),
Text Box( "Written by Lisa Winland lisawinland@icloud.com" )
)
)
)
);
next = Expr(
Show( nm );
colvalues = Associative Array( Column( nm ) ) << Get Keys;
Show( colvalues );
listvalues = {};
Show( nY );
nw = New Window( "User Input for Dunnett's",
Outline Box( "Level Selection for Dunnett's",
values = {};
i = 1;
For( i = 1, i <= N Items( colvalues ), i += 1,
Values[i] = Char( colvalues[i] )
);
Show( Values );
H List Box(
Text Box( "Select Value for Control" ),
listvalues = List Box( Values )
);,
Button Box( "OK",
level = (listvalues << Get selected);
nw << Close Window;
Eval( fiteval );
Show( level );
)
)
);
);
Fiteval = Expr(
Show( nm );
Show( nY );
Show( level );
controllevel = (Char( nm ) || ":" || Char( level ));
Show( controllevel );
Fit Model(
Y( Eval( nY ) ),
Effects( Eval( nm ) ),
Personality( "Standard Least Squares" ),
Emphasis( "Minimal Report" ),
Run(
:Y << {Summary of Fit( 1 ), Analysis of Variance( 1 ), Parameter Estimates( 1 ),
Lack of Fit( 0 ), Expanded Estimates( 1 ), Show Prediction Expression( 1 ),
Sorted Estimates( 1 ), Scaled Estimates( 0 ), Plot Actual by Predicted( 0 ),
Plot Regression( 0 ), Plot Residual by Predicted( 0 ),
Plot Studentized Residuals( 0 ), Plot Effect Leverage( 0 ),
Plot Residual by Normal Quantiles( 0 ), Box Cox Y Transformation( 0 ), Show VIF( 1 ),
Multiple Comparisons(
Effect( Eval( nm ) ),
Comparisons with Control(
1,
Control Level( Eval( Parse( controllevel ) ) ),
Comparisons with Control Decision Chart(
Control Differences Chart( 1, Point Options( "Show Needles" ) )
)
)
)},
)
);
);
dt = Current Data Table();
nc = N Col( dt );
nr = N Row( dt );
Eval( Dia_Window );ScriptingRe: Dunnett's para múltiples YsPrimero intenté lograr tu objetivo de forma interactiva y luego guardé el guión. Parece que puedes hacerlo, pero necesitas enviar la lista de opciones a cada respuesta. Puede insertar expresiones para acomodar múltiples respuestas.
Names Default to Here( 1 );
dt = Open( "$SAMPLE_DATA/Big Class.jmp" );
fit = dt << Fit Model(
Y( :height, :weight ),
Effects( :age ),
Personality( "Standard Least Squares" ),
Emphasis( "Effect Leverage" ),
Run(
:height << {Summary of Fit( 1 ), Analysis of Variance( 1 ),
Parameter Estimates( 1 ), Lack of Fit( 0 ), Scaled Estimates( 0 ),
Plot Actual by Predicted( 1 ), Plot Regression( 0 ),
Plot Residual by Predicted( 1 ), Plot Studentized Residuals( 0 ),
Plot Effect Leverage( 1 ), Plot Residual by Normal Quantiles( 0 ),
Box Cox Y Transformation( 0 ),
Multiple Comparisons( Effect( :age ), Tukey HSD( 1 ) )},
:weight << {Summary of Fit( 1 ), Analysis of Variance( 1 ),
Parameter Estimates( 1 ), Lack of Fit( 0 ), Scaled Estimates( 0 ),
Plot Actual by Predicted( 1 ), Plot Regression( 0 ),
Plot Residual by Predicted( 1 ), Plot Studentized Residuals( 0 ),
Plot Effect Leverage( 1 ), Plot Residual by Normal Quantiles( 0 ),
Box Cox Y Transformation( 0 ),
Multiple Comparisons(
Effect( :age ),
Comparisons with Control(
1,
Control Level( "age:12" ),
Comparisons with Control Decision Chart(
Control Differences Chart( 1, Point Options( "Show Needles" ) )
)
)
)}
)
);Re: Dunnett's para múltiples YsNo pude hacer que los Dunnett aceptaran una variable para el efecto o el nivel de control. ¿Cómo consigues que acepte una variable?
Necesito algo donde seleccionen la variable y el nivel, luego se repite para cada respuesta. Cómo lo tiene en su respuesta es el nombre real de la columna y el nivel real.
Re: Dunnett's para múltiples YsModifiqué mi ejemplo más para mostrarle cómo usar expresiones para construir el script adaptativo para cualquier cantidad de respuestas.
For( c = 1, c <= N Items( y ), c++,
Insert Into( run expr,
Substitute(
Expr(
yyy << {Summary of Fit( 1 ), Analysis of Variance( 1 ),
Parameter Estimates( 1 ), Lack of Fit( 0 ), Scaled Estimates( 0 ),
Plot Actual by Predicted( 1 ), Plot Regression( 0 ),
Plot Residual by Predicted( 1 ), Plot Studentized Residuals( 0 ),
Plot Effect Leverage( 1 ), Plot Residual by Normal Quantiles( 0 ),
Box Cox Y Transformation( 0 ),
Multiple Comparisons(
Effect( :age ),
Comparisons with Control(
1,
Control Level( "age:12" ),
Comparisons with Control Decision Chart(
Control Differences Chart( 1, Point Options( "Show Needles" ) )
)
)
)}
),
Expr( yyy ),
y[c];
)
)
);
Eval(
Substitute(
Expr(
fit = dt << Fit Model(
Y( Eval( y ) ),
Effects( Eval( x ) ),
Personality( "Standard Least Squares" ),
Emphasis( "Effect Leverage" ),
rrr
)
),
Expr( rrr ),
Name Expr( run expr )
)
);Re: Dunnett's para múltiples YsPero en su ejemplo, el efecto sigue siendo el nombre de la columna y también lo es el nivel de control. Puedes hacer algo como:
efecto (eval (x))
Comparaciones con control (
1,
nivel de control (eval (nivel)),
No puedo conseguir que esto funcione. ¿O tienes que tenerlo como los nombres reales?

Re: Dunnett para Múltiples Ys¿Qué se captura en su cuadro de diálogo para las selecciones de columna? ¿Es una referencia de columna o un nombre (cadena de caracteres)?
Asumiendo que es una cadena de caracteres, este código podría funcionar.
Names Default to Here( 1 );
// example
dt = Open( "$SAMPLE_DATA/Big Class.jmp" );
// values from dialog
y = List( "height", "weight" );
x = "age";
level = 12;
// empty run argument for Fit Model message
run expr = Expr( Run() );
// iteratively add the optons for each response
For( c = 1, c <= N Items( y ), c++,
Insert Into( run expr,
Substitute(
Expr(
yyy << {Summary of Fit( 1 ), Analysis of Variance( 1 ),
Parameter Estimates( 1 ), Lack of Fit( 0 ), Scaled Estimates( 0 ),
Plot Actual by Predicted( 1 ), Plot Regression( 0 ),
Plot Residual by Predicted( 1 ), Plot Studentized Residuals( 0 ),
Plot Effect Leverage( 1 ), Plot Residual by Normal Quantiles( 0 ),
Box Cox Y Transformation( 0 ),
Multiple Comparisons(
Effect( xxx ),
Comparisons with Control(
1,
Control Level( ccc ),
Comparisons with Control Decision Chart(
Control Differences Chart( 1, Point Options( "Show Needles" ) )
)
)
)}
),
Expr( yyy ),
Parse( ":" || y[c] ),
Expr( xxx ),
Parse( ":" || x ),
Expr( ccc ),
x || ":" || Char( level )
)
)
);
// complete message and evaluate it
Eval(
Substitute(
Expr(
fit = dt << Fit Model(
Y( Eval( y ) ),
Effects( Eval( x ) ),
Personality( "Standard Least Squares" ),
Emphasis( "Minimal Report" ),
rrr
)
),
Expr( rrr ),
Name Expr( run expr )
)
);