Informe de datos de LSMeans Differences t de StudentHola a todos,
Estoy tratando de hacer un informe con datos específicos de la tabla de LSMeans Differences t de Student:

Me gustaría una tabla con uno de los formatos que se muestran a continuación:


Lamentablemente, no puedo imprimir correctamente la media y no puede tomar datos de la tabla más grande. Obtengo lo siguiente

Probé el siguiente código, donde cambié el '17' por números del 1 al 30 y nada funciona: 17 es para un cuadro de contorno diferente:
sd = Open( "test_table.jmp" );<BR /><BR />Fitmod = Fit Model(<BR />Y( :"Test value"n ),<BR />Effects( :Person ),<BR />Random Effects( :Day[:Person] ),<BR />NoBounds( 0 ),<BR />Personality( "Standard Least Squares" ),<BR />Method( "REML" ),<BR />Emphasis( "Effect Leverage" ),<BR />Run(<BR />:"Test value"n << {Summary of Fit( 1 ),<BR />Analysis of Variance( 0 ), Parameter Estimates( 1 ), Scaled Estimates( 0 ),<BR />Plot Actual by Predicted( 1 ), Plot Regression( 0 ),<BR />Plot Residual by Predicted( 1 ), Plot Studentized Residuals( 0 ),<BR />Plot Effect Leverage( 1 ), Plot Residual by Normal Quantiles( 0 ),<BR />{:Person << {LSMeans Student's t( 0.05 )}}}<BR />),<BR />Where( :ID == "A1" ),<BR />SendToReport(<BR />Dispatch(<BR />{"Test value ID=A1"},<BR />"Whole Model",<BR />OutlineBox,<BR />{Close( 1 )}<BR />),<BR />Dispatch(<BR />{"Test value ID=A1", "Person"},<BR />"Leverage Plot",<BR />OutlineBox,<BR />{Close( 1 )}<BR />)<BR />)<BR />);<BR /><BR />report(Fitmod) [Outline Box( 2 )] << Close( 0 );<BR />reportFitmod = Fitmod << Report;<BR /><BR /><STRONG>sumfit = reportFitmod[Outline Box( 17 )][Number Col Box( 1 )] << Get as Matrix;
meandiff = sumfit[1];
lowerCL = sumfit[3];
upperCL = sumfit[4];</STRONG><BR /><BR />term = reportFitmod[Outline Box( 13 )][String Col Box( 1 )] << Get();<BR /><BR />est = reportFitmod[Outline Box( 13 )][Number Col Box( 1 )] << Get as Matrix;<BR /><BR />dvalues = [];<BR />dvalues = meandiff |/ lowerCL |/ upperCL ;<BR />sfactor = term[2];<BR /><BR />dlg = New Window( "Custom Report",<BR />Outline Box( "Selected Values",<BR />Lineup Box( N Col( 2 ),<BR />Text Box( "Factor of Interest: " ),<BR />Text Box( sfactor ), ),<BR />tb = Table Box(<BR /><BR />String Col Box( " ",<BR />{"Mean difference: ", "Upper limit: ", "Lower limit: "}<BR />),<BR />Spacer Box( Size( 30, 30 ) ),<BR />,<BR />Spacer Box( Size( 0, 30 ) ),<BR />,<BR />Table Box(<BR />CloneTerm,<BR />Spacer Box( Size( 10, 0 ) ),<BR />,<BR />Number Col Box( "Estimate", est ),<BR />Spacer Box( Size( 10, 0 ) ),<BR />,<BR />Number Col Box( "Mean difference", meandiff)<BR />)<BR />)<BR />);<BR /><BR />tb << Set Shade Headings( 0 ); // Turn off shaded table headings.<BR />tb << Set Heading Column Borders( 0 ); // Turn off table column borders.<BR />
¿Cómo se informan los datos de la tabla más grande?
Atentamente
Automatización y scriptingRe: Informe de datos de LSMeans Differences t de StudentBienvenido a la comunidad JMP.
Creo que hay una confusión entre la tabla de datos que adjuntaste y el script que adjuntaste. Las referencias en el script a las columnas que se analizarán no coinciden con las columnas de la tabla de datos adjunta.
Si puede proporcionar los archivos adjuntos correctos, estoy seguro de que la Comunidad podrá ayudarlo en sus esfuerzos.
Re: Informe de datos de LSMeans Differences t de StudentQuerido Jim,
Pido disculpas por la confusión. Gracias por informarme. Ya he adjuntado el guión correcto.
Julia
Re: Informe de datos de LSMeans Differences t de StudentEsto puede darle una ventaja para obtener su producto final. Produce

Names Default To Here( 1 );
sd = //Open( "test_table.jmp" );
Data Table( "test_table" );
Fitmod = Fit Model(
Y( :"Test value"n ),
Effects( :Person ),
Random Effects( :Day[:Person] ),
NoBounds( 0 ),
Personality( "Standard Least Squares" ),
Method( "REML" ),
Emphasis( "Effect Leverage" ),
Run(
:"Test value"n << {Summary of Fit( 1 ), Analysis of Variance( 0 ), Parameter Estimates( 1 ), 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 ), {:Person << {LSMeans Student's t( 0.05 )}}}
),
Where( :ID == "A1" ),
SendToReport(
Dispatch( {"Test value ID=A1"}, "Whole Model", OutlineBox, {Close( 1 )} ),
Dispatch( {"Test value ID=A1", "Person"}, "Leverage Plot", OutlineBox, {Close( 1 )} )
)
);
Report( Fitmod )[Outline Box( 2 )] << Close( 0 );
reportFitmod = Fitmod << Report;
sumfit = reportFitmod[Outline Box( "Least Squares Means Table" )][Number Col Box( 1 )] << Get as Matrix;
// Get data from CrossTab table
crossTab = reportFitmod[Outline Box( "LSMeans Differences Student's t" )][CrosstabBox( 1 )] << get as matrix;
// Get Where clause variable
whereCol = Word( 2, ((reportFitmod << parent)[Text Box( 1 )]) << get text, ":=)" );
whereVal = {};
Eval( Parse( "insert into(whereVal," || Word( 2, ((reportFitmod << parent)[Text Box( 1 )]) << get text, "=)" ) || ");" ) );
meandiff = Round( Abs( crossTab[1, 2] ), 4 );
lowerCL = Round( Abs( crossTab[3, 2] ), 3 );
upperCL = Round( Abs( crossTab[4, 2] ), 3 );
term = reportFitmod[Outline Box( "Least Squares Means Table" )][String Col Box( 1 )] << Get();
est = reportFitmod[Outline Box( "Least Squares Means Table" )][Number Col Box( 1 )] << Get as Matrix;
testValue = {};
Insert Into( testValue, (Substr( reportFitmod[Outline Box( 1 )] << get title, 10 )) );
dif = {};
Insert Into( dif, Char( meandiff ) || " [" || Char( lowerCL ) || ";" || Char( upperCL ) || "]" );
dlg = New Window( "Custom Report",
Outline Box( "Selected Values",
Lineup Box( N Col( 2 ), Text Box( "Factor of Interest: " ), Text Box( sfactor ) ),
Spacer Box( size( 0, 10 ) ),
tb = Table Box(
String Col Box( "Test Value", testvalue ),
String Col Box( whereCol, whereVal ),
Number Col Box( "Mean, " || term[1], sumfit[1] ),
Number Col Box( "Mean, " || term[2], sumfit[2] ),
String Col Box( "Difference in mean and CI", dif )
)
)
);
tb << Set Shade Headings( 0 ); // Turn off shaded table headings.
tb << Set Column Borders( 1 ); // Turn off table column borders.
tb << Set row Borders( 1 );
tb << border( 1 );
Re: Informe de datos de LSMeans Differences t de StudentHola Jim,
¿Cómo se debe modificar el script si hay varios identificadores para generar una tabla con todos los elementos diferentes? ¿Se puede implementar un bucle para esto?
Atentamente,
Julia
Re: Informe de datos de LSMeans Differences t de StudentHe modificado el JSL para poder manejar múltiples niveles de identificación.

Names Default To Here( 1 );
sd = //Open( "test_table.jmp" );
Data Table( "test_table " );
Fitmod = Fit Model(
Y( :"Test value"n ),
Effects( :Person ),
Random Effects( :Day[:Person] ),
NoBounds( 0 ),
Personality( "Standard Least Squares" ),
Method( "REML" ),
Emphasis( "Effect Leverage" ),
Run(
:"Test value"n << {Summary of Fit( 1 ), Analysis of Variance( 0 ), Parameter Estimates( 1 ),
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 ), {:Person << {LSMeans Student's t( 0.05 )}}}
),
by( :ID ),
SendToReport(
Dispatch( {"Test value ID=A1"}, "Whole Model", OutlineBox, {Close( 1 )} ),
Dispatch( {"Test value ID=A1", "Person"}, "Leverage Plot", OutlineBox, {Close( 1 )} )
)
);
// Set the lists for the storage of the data from the by groups
whereVal = testValue = dif = sumfit1 = sumfit2 = {};
// Loop across each by group and gather the data
For Each( {rpt, group}, Fitmod,
// Point to the current report
reportFitmod = Fitmod[group] << Report;
// Get the means for the 2 levels
sumfit = reportFitmod[Outline Box( "Least Squares Means Table" )][Number Col Box( 1 )] << Get as Matrix;
Insert Into( sumfit1, sumfit[1] );
Insert Into( sumfit2, sumfit[2] );
term = reportFitmod[Outline Box( "Least Squares Means Table" )][String Col Box( 1 )] << Get();
// Get By Group column
whereCol = Word( 1, (reportFitmod[Outline Box( 1 )] << get title), "=)" );
Insert Into( whereVal, Word( 2, (reportFitmod[Outline Box( 1 )] << get title), "=)" ) );
// Get data from CrossTab table
crossTab = reportFitmod[Outline Box( "LSMeans Differences Student's t" )][CrosstabBox( 1 )] <<
get as matrix;
meandiff = Round( Abs( crossTab[1, 2] ), 4 );
lowerCL = Round( Abs( crossTab[3, 2] ), 3 );
upperCL = Round( Abs( crossTab[4, 2] ), 3 );
// Get the Response variable name
Insert Into( testValue, (Substr( (reportFitmod << topparent)[Outline Box( 1 )] << get title, 10 )) );
// Create the Differeence in mean and CL string
Insert Into( dif, Char( meandiff ) || " [" || Char( lowerCL ) || ";" || Char( upperCL ) || "]" );
);
// Create the table
dlg = New Window( "Custom Report",
Outline Box( "Selected Values",
Lineup Box( N Col( 2 ), Text Box( "Factor of Interest: " ), Text Box( term[1] ) ),
Spacer Box( size( 0, 10 ) ),
tb = Table Box(
String Col Box( "Test Value", testvalue ),
String Col Box( whereCol, whereVal ),
Number Col Box( "Mean, " || term[1], sumfit1 ),
Number Col Box( "Mean, " || term[2], sumfit2 ),
String Col Box( "Difference in mean and CI", dif )
)
)
);
tb << Set Shade Headings( 0 ); // Turn off shaded table headings.
tb << Set Column Borders( 1 ); // Turn off table column borders.
tb << Set row Borders( 1 );
tb << border( 1 );
Ahora, su trabajo consiste en estudiar el script y aprender lo que hace. El script funciona para la tabla de datos de muestra y el modelo de ajuste que especificó. Sin embargo, es posible que distintas tablas de datos con distintas columnas y distintas ejecuciones del modelo de ajuste no funcionen con el JSL que genera la salida del informe. Deberá adquirir los conocimientos necesarios para modificar el script para que se ajuste a sus necesidades.
Buenas referencias para esto son la Guía de scripts y el Índice de scripts, disponibles en el menú desplegable Ayuda en JMP.
Por supuesto, la comunidad de discusión de JMP estará allí para ayudarlo a aprender el script.
Re: Informe de datos de LSMeans Differences t de Student¡Gracias por tu impresionante trabajo!
He intentado ejecutar el script, pero me aparece un error. He intentado buscar en Google y en casos antiguos la función For Each y el error, y también he intentado modificar el script, pero no he tenido éxito. Tengo la versión 16, ¿podría esto representar un problema para el script?
Creo que el error proviene de {rpt, grupo}, ya que intenté eliminar todo en For Each y sigo recibiendo este error.

Puedo entender la mayor parte, pero ¿de dónde obtenemos este rpt y cómo se usa? Solo se menciona en For Each({rpt, group}...) así que no puedo explicar cómo encaja.
Re: Informe de datos de LSMeans Differences t de Student¿Qué versión de JMP estás usando? For Each() se agregó a JMP en la versión 16. La funcionalidad By() en Fit Mod no se agregó hasta JMP 18.
Será necesario modificar el script para manejar ambos cambios.
Re: Informe de datos de LSMeans Differences Prueba t de StudentUso la versión 16.1.0 de JMP, así que esa debe ser la razón.
¿Es necesario reemplazar la función FitMod por otra función o FitMod aún puede usarse de manera diferente?
Re: Informe de datos de LSMeans Differences t de StudentAquí hay una versión modificada del script. Lo he probado en JMP 16. Eliminé la cláusula By y reemplacé la funcionalidad con un bucle For Each() que ejecuta el modelo de ajuste para cada nivel de ID por separado. Luego, el script recopila la salida de cada una de las salidas independientes del modelo de ajuste y genera la visualización de salida final.

Names Default To Here( 1 );
sd = //Open( "test_table.jmp" );
Data Table( "test_table" );
Fitmod = {};
// Determine the levels in the ID column
summarize( sd, ByGroups = By( :ID ) );
// Loop across each levle of ID
For Each( {BG, group}, ByGroups,
Fm = Fit Model(
Y( :"Test value"n ),
Effects( :Person ),
Random Effects( :Day[:Person] ),
NoBounds( 0 ),
Personality( "Standard Least Squares" ),
Method( "REML" ),
Emphasis( "Effect Leverage" ),
Run(
:"Test value"n << {Summary of Fit( 1 ), Analysis of Variance( 0 ),
Parameter Estimates( 1 ), 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 ), {:Person << {LSMeans Student's t( 0.05 )}}}
),
Where( :ID == ByGroups[group] ),
SendToReport(
Dispatch( {"Test value ID=A1"}, "Whole Model", OutlineBox, {Close( 1 )} ),
Dispatch(
{"Test value ID=A1", "Person"},
"Leverage Plot",
OutlineBox,
{Close( 1 )}
)
)
);
// Save the pointer to the results in the Fitmod list
Insert Into( Fitmod, Fm );
);
// Set the lists for the storage of the data from the by groups
testValue = dif = sumfit1 = sumfit2 = {};
// Loop across each by group and gather the data
For Each( {rpt, group}, Fitmod,
// Point to the current report
reportFitmod = Fitmod[group] << Report;
// Get the means for the 2 levels
sumfit = reportFitmod[Outline Box( "Least Squares Means Table" )][Number Col Box( 1 )] << Get as Matrix;
Insert Into( sumfit1, sumfit[1] );
Insert Into( sumfit2, sumfit[2] );
term = reportFitmod[Outline Box( "Least Squares Means Table" )][String Col Box( 1 )] << Get();
// Get By Group column
whereCol = Word( 2, ((reportFitmod << parent)[Text Box( 1 )]) << get text, ":=)" );
// Get data from CrossTab table
crossTab = reportFitmod[Outline Box( "LSMeans Differences Student's t" )][CrosstabBox( 1 )] <<
get as matrix;
meandiff = Round( Abs( crossTab[1, 2] ), 4 );
lowerCL = Round( Abs( crossTab[3, 2] ), 3 );
upperCL = Round( Abs( crossTab[4, 2] ), 3 );
// Get the Response variable name
Insert Into( testValue, (Substr( (reportFitmod << topparent)[Outline Box( 1 )] << get title, 10 )) );
// Create the Differeence in mean and CL string
Insert Into( dif, Char( meandiff ) || " [" || Char( lowerCL ) || ";" || Char( upperCL ) || "]" );
);
// Create the table
dlg = New Window( "Custom Report",
Outline Box( "Selected Values",
Lineup Box( N Col( 2 ), Text Box( "Factor of Interest: " ), Text Box( term[1] ) ),
Spacer Box( size( 0, 10 ) ),
tb = Table Box(
String Col Box( "Test Value", testvalue ),
String Col Box( whereCol, ByGroups ),
Number Col Box( "Mean, " || term[1], sumfit1 ),
Number Col Box( "Mean, " || term[2], sumfit2 ),
String Col Box( "Difference in mean and CI", dif )
)
)
);
tb << Set Shade Headings( 0 ); // Turn off shaded table headings.
tb << Set Column Borders( 1 ); // Turn off table column borders.
tb << Set row Borders( 1 );
tb << border( 1 );Re: Informe de datos de LSMeans Differences t de StudentHola Jim,
¡Muchas gracias!
Atentamente,
Julia
Re: Informe de datos de LSMeans Differences t de StudentHola Jim,
Tengo una pregunta adicional. Si quiero ejecutar el análisis con muchos valores de prueba, ¿podría hacer lo siguiente?
1. ¿Hacer un bucle con FitModel y luego continuar como en el script anterior?
2. ¿Realizo el análisis por separado, donde obtengo el informe en un solo informe y luego ejecuto un script que guarda los datos como el script anterior?
¿O hay otra forma que debería intentar investigar?
Atentamente,
Julia
Re: Informe de datos de LSMeans Differences t de StudentJulia,
Cualquiera de los dos enfoques probablemente funcionaría.
Me parece que tomar esta decisión es una decisión muy importante al principio. Primero, pensaría en cómo quiero que se vea el producto final y luego tomaría el script y lo modificaría para obtener ese resultado con solo 2 valores de prueba. Eso le brindará un poco más de información sobre cuál debería ser el enfoque y también le mostrará qué áreas de JSL necesita conocer más para expandir el script a su producto final.
Re: Informe de datos de LSMeans Differences t de StudentHola Jim,
Es bueno saber que ambos enfoques son posibles en JSL.
¿Sería posible alterar el código para que también Y( :"Valor de prueba"n ) recorra todas las columnas continuas?
// Determine the levels in the ID column
summarize( sd, ByGroups = By( :ID ) );
// Loop across each level of ID
For Each( {BG, group}, ByGroups,
Fm = Fit Model(
Y( :"Test value"n ),
Effects( :Person ),
Random Effects( :Day[:Person] ),
NoBounds( 0 ),
Personality( "Standard Least Squares" ),
Method( "REML" ),
Emphasis( "Effect Leverage" ),
Run(
:"Test value"n << {Summary of Fit( 1 ), Analysis of Variance( 0 ),
Parameter Estimates( 1 ), 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 ), {:Person << {LSMeans Student's t( 0.05 )}}}
),
Where( :ID == ByGroups[group] ),
SendToReport(
Dispatch( {"Test value ID=A1"}, "Whole Model", OutlineBox, {Close( 1 )} ),
Dispatch(
{"Test value ID=A1", "Person"},
"Leverage Plot",
OutlineBox,
{Close( 1 )}
)
)
);
// Save the pointer to the results in the Fitmod list
Insert Into( Fitmod, Fm );
);He analizado muchos otros bucles y he intentado modificarlos de la siguiente manera:
Names Default To Here( 1 );
sd = Open( "test_table_002.jmp" );
Data Table( "test_table_002" );
Fitmod = {};
// Determine the levels in the ID column
summarize( sd, ByGroups = By( :ID ) );
colList = sd << Get Column Names( Continuous, String );
// Loop across each level of ID
For Each( i = 1, i <= Nitems( colList ), i++,
For Each( {BG, group}, ByGroups,
Fm = Fit Model(
Y( colList ),
Effects( :Person ),
Random Effects( :Day[:Person] ),
NoBounds( 0 ),
Personality( "Standard Least Squares" ),
Method( "REML" ),
Emphasis( "Effect Leverage" ),
Run(
colList << {Summary of Fit( 1 ), Analysis of Variance( 0 ),
Parameter Estimates( 1 ), 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 ), {:Person << {LSMeans Student's t( 0.05 )}}}
),
Where( :ID == ByGroups[group] ),
SendToReport(
Dispatch( {"Test value ID=A1"}, "Whole Model", OutlineBox, {Close( 1 )} ),
Dispatch(
{"Test value ID=A1", "Person"},
"Leverage Plot",
OutlineBox,
{Close( 1 )}
)
)
);
// Save the pointer to the results in the Fitmod list
Insert Into( Fitmod, Fm );
);
);Sin embargo, me aparece un código de error que no entiendo del todo.
He adjuntado una tabla de prueba y he comprobado que he adjuntado la correcta.
Atentamente,
Julia
Re: Informe de datos de LSMeans Differences t de Student¿Cuál es el mensaje de error?
Re: Informe de datos de LSMeans Differences t de StudentAquí está el mensaje de error:

Solo tengo 43 líneas en el guión por ahora.
Re: Informe de datos de LSMeans Differences t de StudentLa modificación de su script está muy cerca de funcionar. En la línea 11, está especificando
For Each( i = 1, i <= Nitems( colList ), i++,
Debería serlo
For( i = 1, i <= Nitems( colList ), i++,
Existe una gran diferencia entre las funciones For Each() y For(). La definición y los ejemplos de las dos funciones diferentes se pueden encontrar en el Índice de secuencias de comandos.
También necesitarás cambiar tus referencias a
Lista de col
en las líneas 15 y 23 para especificar a cuál de los elementos de colList está haciendo referencia.
Dado que está utilizando la variable "i" como valor de índice de búsqueda, deberá especificar
colList[i]
En la tabla de datos de ejemplo que proporcionó, solo tiene la columna Valor de prueba como sus columnas numéricas (continuas), por lo que solo repetirá una vez con su función For(). Sin embargo, si agrega más columnas numéricas (continuas), el código con las modificaciones a la sintaxis que mencioné se ejecutará para cada una de las columnas numéricas (continuas).
Re: Informe de datos de LSMeans Differences t de Student¡Gracias! ¡Eso tiene mucho sentido!
Una última pregunta, si quiero alterar el texto del Despacho que se envía al informe, ¿cómo lo haría?
Actualmente es "Valor de prueba ID=A1" y lo que se imprime es fx Valor de prueba 1 o Valor de prueba 2. Cuando intenté cambiar a "Valor de prueba ID=colList", se imprimió lo mismo, así que no entiendo cómo funciona.
Me gustaría que se imprima el siguiente texto para el valor de prueba fx 1 con ID A1: "Valor de prueba 1, ID=A1". Probé con diferentes cadenas y funciones, pero me aparece un error o simplemente se imprime igual que antes.
Atentamente,
Julia
Re: Informe de datos de LSMeans Differences t de StudentNo entiendo lo que dices. Lo abordaré desde otra perspectiva. Aquí está el resultado de tu tabla de datos para la columna Valor de prueba 1

¿Qué desea cambiar de esta salida?
Re: Informe de datos de LSMeans Differences t de StudentQuerido Jim,
Lo he escrito en la imagen donde quiero cambiarlo y a qué:

Si no especifica el ID, entonces no sé cómo diferenciar entre las diferentes ventanas que aparecen cuando hay múltiples ID.
Espero que esto tenga más sentido.:)
Atentamente,
Julia
Re: Informe de datos de LSMeans Differences t de StudentPuede cambiar el valor de la salida del informe ajustando los objetos del Árbol de visualización.

Añadiendo
report(fm)[OutlineBox(1)]<<SET title=""></SET>
prior to
// Save the pointer to the results in the Fitmod list
Insert Into( Fitmod, Fm );
Cambiará el título al valor que desees que tenga.
Re: Informe de datos de LSMeans Differences t de StudentQuerido Jim,
¡Muchas gracias por toda tu ayuda! Realmente lo aprecio y ha sido un gran aprendizaje para mí también. El script ahora es completamente funcional y se puede utilizar con muchos conjuntos de datos.
Atentamente,
Julia
Re: Informe de datos de LSMeans Differences t de StudentQuerido Jim,
He estado usando el script y luego noté que cuando imprimo los datos, la lista de parámetros no me da todos los diferentes parámetros de valor de prueba, sino solo el valor de prueba 1:

Me doy cuenta de que es por la siguiente parte del guión:
// Get the Response variable name
Insert Into( testValue, (Substr( (reportFitmod << topparent)[Outline Box( 1 )] << get title, 10 )) );
He intentado modificarlo, pero todavía imprime solo el parámetro, da un error o imprime algo que no tengo idea de dónde proviene.
Atentamente,
Julia
Re: Informe de datos de LSMeans Differences Prueba t de StudentYa no puedo reconstruir el script completo que estás usando. Adjunta el script completo que estás usando.
Re: Informe de datos de LSMeans Differences Prueba t de StudentHola Jim,
He adjuntado una tabla de datos de trabajo y el script.
ES/
Julia
Re: Informe de datos de LSMeans Differences t de StudentTomé un atajo para resolver el problema. Agregué una lista JMP llamada "títulos" que se completa después de cada ejecución e inmediatamente después de que se establece el título de Outline Box(). Luego, simplemente uso la lista de títulos en Table Box() en la sección dlg.

Names Default To Here( 1 ); // will ignore normal JSL naming
sd = currentdatatable(); // call upon open data table
// Define that Fitmod is empty. We will fill this with our information in the loop
Fitmod = {};
// Determine the levels in the ID column
summarize( sd, ByGroups = By( :Batch ) );
// Determine the result columns
colList = sd << Get Column Names( Continuous, String );
sum = 0; // Prepare getting the total number of result columns. Will be updated in the loop
titles = {};
// Loop across each level of Batch
nw_means = New Window("My Report",
For( i = 1, i <= Nitems( colList ), i++,
For Each( {BG, group}, ByGroups,
Fm = Fit Model(
Y( colList[i] ),
Effects( :Laboratory ),
Random Effects( :Day[:Laboratory] ),
NoBounds( 0 ),
Personality( "Standard Least Squares" ),
Method( "REML" ),
Emphasis( "Effect Leverage" ),
Run(
colList[i] << {Summary of Fit( 1 ), Analysis of Variance( 0 ),
Parameter Estimates( 1 ), 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 ), {:Person << {LSMeans Student's t( 0.05 )}}}
),
Where( :Batch == ByGroups[group] ),
SendToReport(
Dispatch( {"" }, "Whole Model", OutlineBox, {Close( 1 )} ),
Dispatch(
{"", "Laboratory"},
"Leverage Plot",
OutlineBox,
{Close( 1 )}
)
)
);
report(fm)[OutlineBox(1)] << set title(report(fm)[OutlineBox(1)] << get title || ", ID=" || BG);
// Save the pointer to the results in the Fitmod list
Insert Into( Fitmod, Fm );
insert into(titles, report(fm)[OutlineBox(1)] << get title);
);
sum = sum + 1
);
);
// Set the lists for the storage of the data from the by groups
testValue = dif = sumfit1 = sumfit2 = {};
// Loop across each by group and gather the data
For Each( {rpt, group}, Fitmod,
// Point to the current report
reportFitmod = Fitmod[group] << Report;
// Get the means for the 2 levels
sumfit = reportFitmod[Outline Box( "Least Squares Means Table" )][Number Col Box( 1 )] << Get as Matrix;
Insert Into( sumfit1, sumfit[1] );
Insert Into( sumfit2, sumfit[2] );
term = reportFitmod[Outline Box( "Least Squares Means Table" )][String Col Box( 1 )] << Get();
// Get By Group column
whereCol = Word( 2, ((reportFitmod << parent)[Text Box( 1 )]) << get text, ":=)" );
// Get data from CrossTab table
crossTab = reportFitmod[Outline Box( "LSMeans Differences Student's t" )][CrosstabBox( 1 )] << get as matrix;
meandiff = Round( crossTab[1, 2] , 4 );
lowerCL = Round( crossTab[3, 2] , 3 );
upperCL = Round( crossTab[4, 2] , 3 );
// Get the Response variable name
Insert Into( testValue, (Substr( (reportFitmod << topparent)[Outline Box( 1 )] << get title, 10 )) );
// Create the Difference in mean and CL string
Insert Into( dif, Char( meandiff ) || " [" || Char( lowerCL ) || " ; " || Char( upperCL ) || "]" );
);
// Create the table
dlg = New Window( "Custom Report",
Outline Box( "Selected Values",
Lineup Box( N Col( 2 ), Text Box( "Factor of Interest: " ), Text Box( term[1] ) ),
Spacer Box( size( 0, 10 ) ),
tb = Table Box(
String Col Box( "Paramenter", titles ),
String Col Box( whereCol, repeat(ByGroups, sum) ),
Number Col Box( "Mean, " || term[1], sumfit1 ),
Number Col Box( "Mean, " || term[2], sumfit2 ),
String Col Box( "Difference in mean and CI", dif )
)
)
);
tb << Set Shade Headings( 0 ); // Turn off shaded table headings.
tb << Set Column Borders( 1 ); // Turn off table column borders.
tb << Set row Borders( 1 );
tb << border( 1 );
Re: Informe de datos de LSMeans Differences t de Student¡Perfección! Gracias