Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Generating Statistics Info
Message
From
27/05/1999 12:44:29
 
 
To
27/05/1999 12:19:42
Cetin Basoz
Engineerica Inc.
Izmir, Turkey
General information
Forum:
Visual FoxPro
Category:
Other
Miscellaneous
Thread ID:
00223474
Message ID:
00223532
Views:
20
>"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
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform