Cara comunità,
abbiamo scoperto che JMP calcola i percentili in modo diverso rispetto ad altri programmi, come posso ottenere lo stesso valore in JMP?
Altri programmi sono ad esempio Oracle SQL ed Excel (PERCENTILE.INC)
Di seguito alcuni riferimenti ed esempi nello script.
Grazie e BR
names default to here(1);
// JMP calculates other Quantiles than Python/Excel
// how to get same values in JMP?
// see:
// web("https://community.jmp.com/t5/Discussions/Quantiles-result-from-JMP-are-different-from-Python/m-p/762983");
// perhaps JMP equal to PERCENTILE.EXC in Excel, and not to PERCENTILE.INC
// Percentile Calculation
// web("https://community.jmp.com/t5/Discussions/Quantile-Percentile-Calculation/m-p/327198");
data = [10.56 10.85 11.08 11.57 11.81 12.27 12.76];
Q80_oracle = 12.178;
// as excel as well
Q80_jmp = Quantile( 0.8, data );
// 12.466
// how can I get same values as in other programs?CIAO,
Ho appena testato il tuo set di dati in Excel e ho ottenuto un valore Q80 in Excel = 12,466, esattamente lo stesso di JMP.
Non posso effettuare il test in Oracle, ma ho notato che in R ottengo un valore Q80 = 12,178. Inoltre, il valore Q90 in R è 12,466.
Deve esserci una spiegazione su come vengono calcolati i quantili tra questi programmi.
Migliore,
STUDENTI
Un'altra cosa:
In R ci sono 9 modi diversi per calcolare i quantili.
Il metodo 6 restituisce lo stesso Q80 di JMP ed Excel

Il metodo 7 restituisce il valore Q80 trovato in Oracle:

Migliore,
STUDENTI
Ciao @Georg : sono curioso; ti dispiace se ti chiedo perché è importante che corrispondano o meno?
Carissimi,
grazie per il contributo. Il motivo per cui ne abbiamo bisogno è "l'aspettativa del cliente", ovvero il destinatario si aspetta un certo modo di calcolare.
Nel frattempo ho trovato un modo con una soluzione alternativa in Python, vedi script qui sotto.
Grazie a tutti e cordiali saluti,
New Table( "Percentile_Cont_Example",
Add Rows( 7 ),
Compress File When Saved( 1 ),
New Table Variable( "SQL",
"with val_tab as
(
select 1 AS lot, 11.08 as value FROM dual
union select 1 AS lot, 12.76 as value FROM dual
union select 1 AS lot,10.85 as value FROM dual
union select 1 AS lot, 11.57 as value FROM dual
union SELECT 1 AS lot, 10.56 as value FROM dual
union select 1 AS lot, 12.27 as value FROM dual
union select 1 AS lot,11.81 as value FROM dual
)
SELECT
val_tab.lot
, val_tab.value
, percentile_cont(0.8) WITHIN GROUP (ORDER BY val_tab.value) OVER (PARTITION BY val_tab.lot) quant80_database
from
val_tab"
),
New Column( "LOT",
Numeric,
"Continuous",
Format( "Best", 12 ),
Set Values( [1, 1, 1, 1, 1, 1, 1] ),
Set Display Width( 60 )
),
New Column( "VALUE",
Numeric,
"Continuous",
Format( "Best", 12 ),
Set Values( [10.56, 10.85, 11.08, 11.57, 11.81, 12.27, 12.76] ),
Set Display Width( 60 )
),
New Column( "QUANT80_DATABASE",
Numeric,
"Continuous",
Format( "Best", 12 ),
Set Values(
[12.178000000000001, 12.178000000000001, 12.178000000000001,
12.178000000000001, 12.178000000000001, 12.178000000000001,
12.178000000000001]
),
Set Display Width( 334 )
),
New Column( "Quantile80_JMP",
Numeric,
"Continuous",
Format( "Best", 12 ),
Formula( Col Quantile( :VALUE, 0.80000000000000004 ) ),
Set Display Width( 141 )
),
New Column( "Quantile80_Python",
Numeric,
"Continuous",
Format( "Best", 12 ),
Formula(
data = (As Column( :VALUE ) << get values)[
Loc( As Column( :LOT ) << get values, :LOT )];
Python Execute(
{data},
{result},
"import numpy as np
result = np.quantile(data, 0.8)
"
);
result;
),
Set Selected,
Set Display Width( 292 )
)
)Come installo numpy per JMP 18? Ho un'installazione separata di python 3.13.2. Ho installato numpy per quella versione ma continuo a ricevere questo errore quando provo a eseguire il codice sopra
ModuleNotFoundError: Please install the Python package NumPy.
at row 7
L'esempio dei pacchetti di installazione Python dall'indice di scripting dovrebbe funzionare
Names Default To Here(1);
// install numpy and pandas packages
Python Install Packages("numpy pandas");
oppure puoi usare il lato python di JMP e usare jpip
import jmp
import jmputils
# update to latest version of pip and setuptools then install numpy & pandas
jmputils.jpip('install --upgrade', 'pip setuptools')
jmputils.jpip('install', 'numpy pandas')
https://www.jmp.com/support/help/en/18.0/#page/jmp/install-a-python-package.shtml#
Hai provato?
Python Install Packages( "numpy" );
Grazie, ha funzionato. Non avevo familiarità con quel comando.
In Excel ci sono due modi,
PERCENTILE.INC e PERCENTILE.EXC.
Il mio problema era che non riuscivo a ottenere lo stesso valore in JMP del cliente con PERCENTILE.INC, quindi era necessaria una soluzione alternativa con Python.