Boucle For pour ajuster les moindres carrésSalut,
J'essaie de sortir le tracé de contour du modèle d'ajustement des moindres carrés. Donc, je génère la boucle for afin que je puisse obtenir le modèle en faisant varier l'un des facteurs.
Le problème est qu'après l'exécution du script, tous les graphiques affichent le même facteur (supposons que l'ID Boule varie). Il affichera le dernier identifiant Boule sur tous les onglets que j'ai générés.
names default to here (1);
dt = current data table ();
listID = {"108400", "108610", "109105", "109350", "109838", "109900", "109903", "109904",
"110397", "110422", "110423", "110939", "111167", "111206", "111309", "111704",
"112505", "113023", "113045", "113227", "113344", "113504", "115983", "116118",
"116489", "116490", "116534", "116609", "119687", "119849", "119852", "120478",
"120856", "121030", "121117", "121640"} ;
nw = new window ("Contour", tb = tab box(),my vlb = v list box());
for (i = 1, i<= n items (listID), i++,
tb << add (listID[i], my vlb = v list box());
my vlb<< append(obj = Fit Model(
Y( :Center_Median_BAPL ),
Effects(
:PLMedian & RS,
:Boule_Position & RS,
:Boule_Position * :Boule_Position,
:Boule_ID
),
Personality( "Standard Least Squares" ),
Emphasis( "Effect Leverage" ),
Run(
Profiler(
1,
Confidence Intervals( 1 ),
Term Value(
PLMedian( 925.7, Min( 908 ), Lock( 0 ), Show( 1 ) ),
Boule_Position( 0.82, Lock( 0 ), Show( 1 ) ),
Boule_ID( listID[i], Lock( 0 ), Show( 1 ) )
),
Simulator(
1,
Factors(
PLMedian << Fixed( 925.7 ),
Boule_Position << Fixed( 0.82 )
),
Responses( Center_Median_BAPL << No Noise )
),
Simulator( 0 )
),
Contour Profiler(
1,
Term Value(
PLMedian( 925.7, Min( 910 ), Max( 925 ), Lock( 0 ), Show( 1 ) ),
Boule_Position( 0.82, Lock( 0 ), Show( 1 ) ),
Boule_ID( listID[i], Lock( 0 ), Show( 1 ) )
),
Simulator(
1,
Factors(
PLMedian << Fixed( 925.7 ),
Boule_Position << Fixed( 0.82 )
),
Responses( Center_Median_BAPL << No Noise )
),
Simulator( 0 ),
Contour Value(
Center_Median_BAPL(
903.5,
Lo Limit( 901 ),
Hi Limit( 905 ),
Min( 893.5 ),
Max( 913.5 )
)
),
Grid Density( "40 x 40" ),
Contour Grid( 900, 910, 1, Center_Median_BAPL ),
Horizontal Factor( :Boule_Position ),
Vertical Factor( :PLMedian )
),
:Center_Median_BAPL << {Summary of Fit( 0 ), Analysis of Variance( 0),
Parameter Estimates( 0 ), Scaled Estimates( 0 ), EffectSummary(0),Lack Of Fit (0), Effect Tests(0), Prediction Profiler (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( 0)}
),
Local Data Filter(
Add Filter(
columns( :Boule_Position ),
Where( :Boule_Position >= 0.5992 & :Boule_Position <= 0.82 )
)
),
SendToReport(
Dispatch(
{"Response Center_Median_BAPL", "Contour Profiler"},
"1",
ScaleBox,
{Min( 0.5992 ), Max( 0.82 ), Inc( 0.02 ), Minor Ticks( 0 ),
Label Row( Show Major Grid( 1 ) )}
),
Dispatch(
{"Response Center_Median_BAPL", "Contour Profiler"},
"2",
ScaleBox,
{Min( 908 ), Max( 925 ), Inc( 1 ), Minor Ticks( 0 ),
Label Row( Show Major Grid( 1 ) )}
),
Dispatch(
{"Response Center_Median_BAPL", "Contour Profiler"},
"Contour Profiler Frame",
FrameBox,
{Frame Size( 513, 467 ), DispatchSeg(
Contour Seg( 4 ),
{Line Color( "None" ), Fill Color( {212, 73, 88} )}
)}
)
)
);
)
);
ScriptingRe: boucle For pour ajuster les moindres carrésJe crois que ce qui se passe, c'est que tout le code de votre plate-forme est ajouté à votre V List Box () avant qu'il ne soit exécuté, et quand il est exécuté, toutes les valeurs de la variable i sont les mêmes, j'ai donc modifié le code à remplacer dans la valeur exacte de la variable, avant que l'ajout n'ait lieu.
Essayez-le et voyez si cela aide ...... Je n'ai pas pu tester le code car je n'ai pas votre table de données avec toutes les spécificités de l'analyse.
Names Default To Here( 1 );
dt = Current Data Table();
listID = {"108400", "108610", "109105", "109350", "109838", "109900", "109903", "109904", "110397", "110422", "110423", "110939", "111167", "111206",
"111309", "111704", "112505", "113023", "113045", "113227", "113344", "113504", "115983", "116118", "116489", "116490", "116534", "116609", "119687",
"119849", "119852", "120478", "120856", "121030", "121117", "121640"};
nw = New Window( "Contour", tb = Tab Box(), my vlb = V List Box() );
For( i = 1, i <= N Items( listID ), i++,
tb << Add( listID[i], my vlb = V List Box() );
Eval(
Substitute(
Expr(
my vlb << append(
obj = Fit Model(
Y( :Center_Median_BAPL ),
Effects( :PLMedian & RS, :Boule_Position & RS, :Boule_Position * :Boule_Position, :Boule_ID ),
Personality( "Standard Least Squares" ),
Emphasis( "Effect Leverage" ),
Run(
Profiler(
1,
Confidence Intervals( 1 ),
Term Value(
PLMedian( 925.7, Min( 908 ), Lock( 0 ), Show( 1 ) ),
Boule_Position( 0.82, Lock( 0 ), Show( 1 ) ),
Boule_ID( __listID__, Lock( 0 ), Show( 1 ) )
),
Simulator(
1,
Factors(
PLMedian << Fixed( 925.7 ),
Boule_Position << Fixed( 0.82 )
),
Responses( Center_Median_BAPL << No Noise )
),
Simulator( 0 )
),
Contour Profiler(
1,
Term Value(
PLMedian( 925.7, Min( 910 ), Max( 925 ), Lock( 0 ), Show( 1 ) ),
Boule_Position( 0.82, Lock( 0 ), Show( 1 ) ),
Boule_ID( __listID__, Lock( 0 ), Show( 1 ) )
),
Simulator(
1,
Factors(
PLMedian << Fixed( 925.7 ),
Boule_Position << Fixed( 0.82 )
),
Responses( Center_Median_BAPL << No Noise )
),
Simulator( 0 ),
Contour Value( Center_Median_BAPL( 903.5, Lo Limit( 901 ), Hi Limit( 905 ), Min( 893.5 ), Max( 913.5 ) ) ),
Grid Density( "40 x 40" ),
Contour Grid( 900, 910, 1, Center_Median_BAPL ),
Horizontal Factor( :Boule_Position ),
Vertical Factor( :PLMedian )
),
:Center_Median_BAPL << {Summary of Fit( 0 ), Analysis of Variance( 0 ), Parameter Estimates( 0 ),
Scaled Estimates( 0 ), EffectSummary( 0 ), Lack Of Fit( 0 ), Effect Tests( 0 ), Prediction Profiler( 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( 0 )}
),
Local Data Filter(
Add Filter( columns( :Boule_Position ), Where( :Boule_Position >= 0.5992 & :Boule_Position <= 0.82 ) )
),
SendToReport(
Dispatch(
{"Response Center_Median_BAPL", "Contour Profiler"},
"1",
ScaleBox,
{Min( 0.5992 ), Max( 0.82 ), Inc( 0.02 ), Minor Ticks( 0 ), Label Row( Show Major Grid( 1 ) )}
),
Dispatch(
{"Response Center_Median_BAPL", "Contour Profiler"},
"2",
ScaleBox,
{Min( 908 ), Max( 925 ), Inc( 1 ), Minor Ticks( 0 ), Label Row( Show Major Grid( 1 ) )}
),
Dispatch(
{"Response Center_Median_BAPL", "Contour Profiler"},
"Contour Profiler Frame",
FrameBox,
{Frame Size( 513, 467 ), DispatchSeg( Contour Seg( 4 ), {Line Color( "None" ), Fill Color( {212, 73, 88} )} )}
)
)
)
)
),
Expr( __ListID__ ), ListID[i]
)
);
);