Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Generating Statistics Info
Message
De
27/05/1999 12:44:29
 
 
À
27/05/1999 12:19:42
Cetin Basoz
Engineerica Inc.
Izmir, Turquie
Information générale
Forum:
Visual FoxPro
Catégorie:
Autre
Divers
Thread ID:
00223474
Message ID:
00223532
Vues:
19
>"Median" ? Is it the value sitting in middle in a series ? If so and number of elements <= 65000 a simple way might be :
>
select myValue into array myArray where !isnull(myValue)
>if type("myArray") # "U"
> if alen(myArray,1) > 1
>    return myArray[floor(alen(myArray,1)/2) + 1]
> else
>    return myArray[1]
> endif
>endif
>return .null.
Cetin

Median should be the midpoint value in a data set.

declare myArray[6]
myArray[1]=22353
myArray[2]=35645
myArray[3]=46000
myArray[4]=100000
myArray[5]=105000
myArray[6]=198000
if type("myArray") # "U"
if alen(myArray,1) > 1
? myArray[floor(alen(myArray,1)/2) + 1]
return myArray[floor(alen(myArray,1)/2) + 1]
else
? myArray[1]
return myArray[1]
endif
endif
return .null.

This gives me the median at 100000. If I run the same set of data through Excels data anyalysis/descriptive statistics it gives me 73000 (which is (46000+100000)/2). What's right?

/Chris
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform