12 ÅžUBAT 2010, Cuma
SERİ Standart Sapma Eşdeğer
SERİ toplam SQL fonksiyonu STDDEV() (standart sapma) modeli mi?
En basit / en iyi uygulamalar bunu hesaplamak için yolu nedir?
Örnek:
SELECT test_id, AVERAGE(result) avg, STDDEV(result) std
FROM tests
GROUP BY test_id
CEVAP
12 ÅžUBAT 2010, Cuma
Kendi uzantısı hesaplama yapabilirsiniz
public static class Extensions
{
public static double StdDev(this IEnumerable<double> values)
{
double ret = 0;
int count = values.Count();
if (count > 1)
{
//Compute the Average
double avg = values.Average();
//Perform the Sum of (value-avg)^2
double sum = values.Sum(d => (d - avg) * (d - avg));
//Put it all together
ret = Math.Sqrt(sum / count);
}
return ret;
}
}
Eğer varsaörnekbütün nüfus yerine nüfusun, o zaman ret = Math.Sqrt(sum / (count - 1)); kullanmalısınız.
Adding Standard Deviation to LINQ by Chris Bennett uzantısı haline dönüştü.
Bunu PaylaÅŸ:

Kod '' zincirleme SERİ anaht...
hesaplamak ve C boost kullanarak örnek...
Basit bir istatistik - ortalama hesapl...
Seri: &; Veya" quot; eÅŸdeÄŸer)...
SVN:eşdeğer GIT dışındakiler?...