Escludere le righe nel calcolo Col QuantileCiao,
Stavo cercando di ottenere Col Quantile( :height, 0.5, :class) ma sembra che il calcolo prenderebbe comunque in considerazione le righe escluse.
C'è un modo per rifiutare le righe escluse nel calcolo del Col Quantile?
Grazie,
Midori
SceneggiaturaRe: Escludi righe in Col Quantile CalculationÈ possibile verificare se la riga è stata esclusa all'interno della funzione Col Quantile().Di seguito è riportato un esempio
Names Default To Here( 1 );
dt = Open( "$SAMPLE_DATA/Big Class.jmp" );
dt << New Column( "Col Quantile Height by Age",
numeric,
continuous,
formula( Col Quantile(If(excluded(rowstate(Row())),., :height), 0.5, :age ) )
);
Ogni volta che lo stato riga escluso cambia per le righe nella tabella dati, la formula calcolerà nuovi valori
Ri: Escludere righe nel calcolo del quantile ColHo provato a creare un ciclo per raccogliere il 50° percentile di molti parametri utilizzando il codice seguente, ma entrambi gli elementi in "test_list" sono uguali (entrambi rappresentano il 50% del peso). Tuttavia, se eseguo le righe manualmente, funzionerà. Posso non utilizzare la funzione Col Quantile() nel ciclo for?
Nomi predefiniti qui (1);
dt = Open( "$SAMPLE_DATA/Big Class.jmp" );
plot_param={
altezza,
peso};
lista_test={};
for(plotcnt=1, plotcnt<=nitems(plot_param), plotcnt++,
pct_50=Col Quantile( If(excluded(rowstate(Row())),., column(plot_param[plotcnt])), 0.5);
test_list[plotcnt]=pct_50;
);
Ri: Escludere righe nel calcolo del quantile Col
Ho provato a creare un ciclo per raccogliere il 50° percentile di molti parametri utilizzando il codice seguente, ma entrambi gli elementi in "test_list" sono uguali (entrambi rappresentano il 50% del peso). Tuttavia, se eseguo le righe manualmente, funzionerà. Posso non utilizzare la funzione Col Quantile() nel ciclo for?
Names Default To Here( 1 );
dt = Open( "$SAMPLE_DATA/Big Class.jmp" );
plot_param={
height,
weight};
test_list={};
for(plotcnt=1, plotcnt<=nitems(plot_param), plotcnt++,
pct_50=Col Quantile( If(excluded(rowstate(Row())),., column(plot_param[plotcnt])), 0.5);
test_list[plotcnt]=pct_50;
); Ri: Escludere righe nel calcolo del quantile ColNames Default To Here( 1 );
dt = Open( "$SAMPLE_DATA/Big Class.jmp" );
plot_param={
height,
weight};
test_list={};
for(plotcnt=1, plotcnt<=nitems(plot_param), plotcnt++,
Eval (Substitute (Expr(pct_50=Col Quantile( If(excluded(rowstate(Row())),., _col_), 0.5)), Expr(_col_), column(plot_param[plotcnt])));
test_list[plotcnt]=pct_50;
);
Ri: Escludere righe nel calcolo del quantile ColA causa di un errore di battitura, ho appena notato che Eval (substitute()) è sufficiente, anche se sostituisci 1 con 1:
Names Default To Here( 1 );
dt = Open( "$SAMPLE_DATA/Big Class.jmp" );
plot_param = {height, weight};
test_list = {};
For( plotcnt = 1, plotcnt <= N Items( plot_param ), plotcnt++,
pct_50 = Eval( Substitute( Expr( Col Quantile( If( Excluded( Row State( Row() ) ), ., Column( plot_param[plotcnt] ) ), 0.5 ) ), 1, 1 ) );
test_list[plotcnt] = pct_50;
);
show(test_list);

Re: Escludi righe nel calcolo del quantile Col@LatentDataTiger , feedback dal supporto JMP (TS-00139301)
Sì, questo è un bug. Gli sviluppatori hanno verificato che si tratta di un problema di memorizzazione nella cache con Col Quantile [& Col Median] in particolare. Le altre funzioni Col non hanno questo problema. Utilizzando Substitute si crea una nuova espressione a ogni iterazione del ciclo in modo che la memorizzazione nella cache non venga utilizzata in modo improprio. Grazie per aver segnalato il problema e presenterò un report di bug.
Quindi, sotto la riga, non c'è Substitute , ma la protezione tramite Eval(Expr()) che corregge il bug.
bell'esempio di @Arn_Cota [versione adattata] che illustra l'effetto:
Vedi altro...Names Default To Here( 1 );
dt = Open( "$SAMPLE_DATA/Big Class.jmp" );
plot_param = {height, weight};
test_list = {};
For( plotcnt = 1, plotcnt <= N Items( plot_param ), plotcnt++,
// Without Exclude, returns correct values
pct_50_v0 = Col Quantile( Column( plot_param[plotcnt] ), 0.5 );
// With Exclude, returns the Quantile for height
pct_50_v1 = Col Quantile(
If( Excluded( Row State( Row() ) ),
.,
Column( plot_param[plotcnt] )
),
0.5
);
// With Eval and Substitute, returns correct values
pct_50_v2 = Eval(
Substitute(
Expr(
Col Quantile(
If( Excluded( Row State( Row() ) ),
.,
Column( plot_param[plotcnt] )
),
0.5
)
),
1, 1
)
);
// use Eval(Expr() to protect the expression against inappropriate caching
pct_50_v3 = Eval(Expr(Col Quantile(
If( Excluded( Row State( Row() ) ),
.,
Column( plot_param[plotcnt] )
),
0.5
)));
// Show different versions
Show(
plotcnt,
Column( plot_param[plotcnt] ),
pct_50_v0,
pct_50_v1,
pct_50_v2,
pct_50_v3
);
test_list[plotcnt] = pct_50_v3;
); Re: Escludi righe nel calcolo del quantile Colesempio/soluzione alternativa aggiunta alla gestione delle espressioni in JMP: suggerimenti e botole