<html><head><meta http-equiv="Content-Type" content="text/html charset=windows-1252"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;"><br><div><div>francesca senatore wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><div class="hmmessage" style="font-size: 12pt; font-family: Calibri; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;"><div dir="ltr"><span style="font-family: Arial, Verdana, Geneva, 'Bitstream Vera Sans', Helvetica, sans-serif; font-size: 15px; line-height: 17.8231201171875px; background-color: rgb(255, 255, 255);">Ciao a tutti, </span><br style="font-family: Arial, Verdana, Geneva, 'Bitstream Vera Sans', Helvetica, sans-serif; font-size: 15px; line-height: 17.8231201171875px; background-color: rgb(255, 255, 255);"><span style="font-family: Arial, Verdana, Geneva, 'Bitstream Vera Sans', Helvetica, sans-serif; font-size: 15px; line-height: 17.8231201171875px; background-color: rgb(255, 255, 255);">sono da poco (e per poco intendo veramente poco) nel mondo python. Sono alle prime armi e non me ne volete se non sono molto preparata. </span></div></div></blockquote><div><br></div><div>Ciao Francesca, </div><div>     benvenuta! :)</div><br><blockquote type="cite"><div class="hmmessage" style="font-size: 12pt; font-family: Calibri; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;"><div dir="ltr"><div><font face="Arial, Verdana, Geneva, Bitstream Vera Sans, Helvetica, sans-serif"><span style="font-size: 15px; line-height: 17.8231201171875px; background-color: rgb(255, 255, 255);">Al momento ho la necessità di eseguire dei test statistici (Kolmogorov-Smirnov test, Two Sample Tests, fit ai minimi quadrati) che erano inclusi in ASURV(analysis survival). Ho visto che python include questo pacchetto statistico. </span></font></div></div></div></blockquote><div><br></div><div>Che intendi? ASURV?</div><div><br></div><div>Che roba è? Io ho trovato questo: <a href="http://python-asurv.sourceforge.net">http://python-asurv.sourceforge.net</a></div><div>È lui?</div><div><br></div><div>In ogni caso guardando mi pare di capire che si tratta di un software per dati astronimici/astro fisici[1]. Corretto?</div><div><br></div><div>Nel caso il tuo dominio fosse quello, ti segnalo questi due progetti:</div><div><br></div><div>**AstroPy**: <a href="http://www.astropy.org">http://www.astropy.org</a></div><div>**AstroML**: <a href="http://www.astroml.org">http://www.astroml.org</a></div><div><br></div><div>Sono ben documentati e molto supportati dalla comunità… certamente meglio di quel porting indicato poco prima.. anyway..</div><div><br></div><div>——</div><div>[1]: <a href="http://www.astrostatistics.psu.edu/statcodes/">http://www.astrostatistics.psu.edu/statcodes/</a></div><div><br></div><br><blockquote type="cite"><div class="hmmessage" style="font-size: 12pt; font-family: Calibri; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;"><div dir="ltr"><div><font face="Arial, Verdana, Geneva, Bitstream Vera Sans, Helvetica, sans-serif"><span style="font-size: 15px; line-height: 17.8231201171875px; background-color: rgb(255, 255, 255);">Il mio problema non sono tanto le routine in se per se (che mi sembrano facili) ma l'inserimento dati. I miei dati includono i famosi censored data (upper e lower limits) ed errori sulle misure. Io vorrei includere anche questi valori </span></font></div></div></div></blockquote><div><br></div><div>ok, il tuo problema è chiaro (a parte che non capisco perché vuoi includere i censored data nel calcolo del fitting.. ma tant'è…. del resto, non hai specificato il dominio.. :P)</div><br><blockquote type="cite"><div class="hmmessage" style="font-size: 12pt; font-family: Calibri; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;"><div dir="ltr"><div><font face="Arial, Verdana, Geneva, Bitstream Vera Sans, Helvetica, sans-serif"><span style="font-size: 15px; line-height: 17.8231201171875px; background-color: rgb(255, 255, 255);">quando faccio correre questi test. </span></font></div></div></div></blockquote><div><br></div><div>effettiva "run", in inglese, significa "correre"… :D (kiddin')</div><br><br><blockquote type="cite"><div class="hmmessage" style="orphans: auto; text-align: start; text-indent: 0px; widows: auto;"><div dir="ltr"><div style="font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; font-family: Calibri; font-size: 12pt; line-height: normal;"></div><div style="font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; font-family: Calibri; font-size: 12pt; line-height: normal;"><span style="font-family: Arial, Verdana, Geneva, 'Bitstream Vera Sans', Helvetica, sans-serif; font-size: 15px; line-height: 17.8231201171875px; background-color: rgb(255, 255, 255);">from scipy import stats </span><br style="font-family: Arial, Verdana, Geneva, 'Bitstream Vera Sans', Helvetica, sans-serif; font-size: 15px; line-height: 17.8231201171875px; background-color: rgb(255, 255, 255);"><br style="font-family: Arial, Verdana, Geneva, 'Bitstream Vera Sans', Helvetica, sans-serif; font-size: 15px; line-height: 17.8231201171875px; background-color: rgb(255, 255, 255);"><span style="font-family: Arial, Verdana, Geneva, 'Bitstream Vera Sans', Helvetica, sans-serif; font-size: 15px; line-height: 17.8231201171875px; background-color: rgb(255, 255, 255);">import numpy as np </span><br style="font-family: Arial, Verdana, Geneva, 'Bitstream Vera Sans', Helvetica, sans-serif; font-size: 15px; line-height: 17.8231201171875px; background-color: rgb(255, 255, 255);"><br style="font-family: Arial, Verdana, Geneva, 'Bitstream Vera Sans', Helvetica, sans-serif; font-size: 15px; line-height: 17.8231201171875px; background-color: rgb(255, 255, 255);"><span style="font-family: Arial, Verdana, Geneva, 'Bitstream Vera Sans', Helvetica, sans-serif; font-size: 15px; line-height: 17.8231201171875px; background-color: rgb(255, 255, 255);">x=<1, 2, 3, 4, 5, 6, 7> </span><br style="font-family: Arial, Verdana, Geneva, 'Bitstream Vera Sans', Helvetica, sans-serif; font-size: 15px; line-height: 17.8231201171875px; background-color: rgb(255, 255, 255);"><br style="font-family: Arial, Verdana, Geneva, 'Bitstream Vera Sans', Helvetica, sans-serif; font-size: 15px; line-height: 17.8231201171875px; background-color: rgb(255, 255, 255);"><span style="font-family: Arial, Verdana, Geneva, 'Bitstream Vera Sans', Helvetica, sans-serif; font-size: 15px; line-height: 17.8231201171875px; background-color: rgb(255, 255, 255);">y=<5, 4, 7, 8, 9, 11, 12> </span><br style="font-family: Arial, Verdana, Geneva, 'Bitstream Vera Sans', Helvetica, sans-serif; font-size: 15px; line-height: 17.8231201171875px; background-color: rgb(255, 255, 255);"></div></div></div></blockquote><div><br></div><div>vabeh, diciamo che questo non è esattamente codice Python.. :P</div><br><blockquote type="cite"><div class="hmmessage" style="font-size: 12pt; font-family: Calibri; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;"><div dir="ltr"><div><br style="font-family: Arial, Verdana, Geneva, 'Bitstream Vera Sans', Helvetica, sans-serif; font-size: 15px; line-height: 17.8231201171875px; background-color: rgb(255, 255, 255);"><span style="font-family: Arial, Verdana, Geneva, 'Bitstream Vera Sans', Helvetica, sans-serif; font-size: 15px; line-height: 17.8231201171875px; background-color: rgb(255, 255, 255);">slope, intercept, r_value, p_value, std_err = stats.linregress(x,y) </span><br style="font-family: Arial, Verdana, Geneva, 'Bitstream Vera Sans', Helvetica, sans-serif; font-size: 15px; line-height: 17.8231201171875px; background-color: rgb(255, 255, 255);"><br style="font-family: Arial, Verdana, Geneva, 'Bitstream Vera Sans', Helvetica, sans-serif; font-size: 15px; line-height: 17.8231201171875px; background-color: rgb(255, 255, 255);"><span style="font-family: Arial, Verdana, Geneva, 'Bitstream Vera Sans', Helvetica, sans-serif; font-size: 15px; line-height: 17.8231201171875px; background-color: rgb(255, 255, 255);">Questa routine mi calcola il fit dandomi tutti i parametri che mi servono.  Nei miei set di dati ci sono upper limit, cioè non detection (i famosi censored data), che voglio tenere in considerazione nel fit. In aggiunta ho un altro set di dati che riguardano gli errori sulle y. Io voglio includere anche questi parametri ma non so come fare. </span><br style="font-family: Arial, Verdana, Geneva, 'Bitstream Vera Sans', Helvetica, sans-serif; font-size: 15px; line-height: 17.8231201171875px; background-color: rgb(255, 255, 255);"><br style="font-family: Arial, Verdana, Geneva, 'Bitstream Vera Sans', Helvetica, sans-serif; font-size: 15px; line-height: 17.8231201171875px; background-color: rgb(255, 255, 255);"><span style="font-family: Arial, Verdana, Geneva, 'Bitstream Vera Sans', Helvetica, sans-serif; font-size: 15px; line-height: 17.8231201171875px; background-color: rgb(255, 255, 255);">Io usavo ASURV per fare cose di questo genere tenendo in considerazione gli upper oppure i lower limits e in questo caso indicavo le detection (i valori effettivamente calcolati) con 0 e con 1 le nondetection (upper limit). Cioè generavo un file con tre colonne dove la prima colonna indicava il tipo di valore. </span><br style="font-family: Arial, Verdana, Geneva, 'Bitstream Vera Sans', Helvetica, sans-serif; font-size: 15px; line-height: 17.8231201171875px; background-color: rgb(255, 255, 255);"><br style="font-family: Arial, Verdana, Geneva, 'Bitstream Vera Sans', Helvetica, sans-serif; font-size: 15px; line-height: 17.8231201171875px; background-color: rgb(255, 255, 255);"><span style="font-family: Arial, Verdana, Geneva, 'Bitstream Vera Sans', Helvetica, sans-serif; font-size: 15px; line-height: 17.8231201171875px; background-color: rgb(255, 255, 255);">Con python ho visto che questo è possibile perchè include molti metodi statistici di ASURV ma non riesco a capire come inserire questi valori. </span><br style="font-family: Arial, Verdana, Geneva, 'Bitstream Vera Sans', Helvetica, sans-serif; font-size: 15px; line-height: 17.8231201171875px; background-color: rgb(255, 255, 255);"></div></div></div></blockquote><div><br></div><div>Io però a questo punto non ho capito quale sia **veramente** il tuo problema..</div><div><br></div><div>In ogni caso, penso che questo possa esserti utile: <a href="https://www.wakari.io/nb/pybokeh/Weibull_Analysis#part2">https://www.wakari.io/nb/pybokeh/Weibull_Analysis#part2</a></div><div>Credo sia proprio un esempio di analisi che si avvicina a ciò che intendi fare…</div><div><br></div><div>In generale, poi, ti segnalo anche `statsmodel`: <a href="https://github.com/statsmodels/statsmodels">https://github.com/statsmodels/statsmodels</a></div><div><br></div><div>Oltre ad estendere le funzionalità di `scipy.stats`, dovrebbe già contenere dei metodi per l'analisi con *suspended* data...</div></div><br><div><br></div><div>HTH</div><div>Valerio</div><div><br></div></body></html>