Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Generating Statistics Info
Message
From
27/05/1999 13:05:37
Cetin Basoz
Engineerica Inc.
Izmir, Turkey
 
 
To
27/05/1999 12:44:29
General information
Forum:
Visual FoxPro
Category:
Other
Miscellaneous
Thread ID:
00223474
Message ID:
00223547
Views:
28
>>"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
Chris,
Go Bruce's way. He knows this and with the formula he supplied that is same as in Excel.
Cetin
Çetin Basöz

The way to Go
Flutter - For mobile, web and desktop.
World's most advanced open source relational database.
.Net for foxheads - Blog (main)
FoxSharp - Blog (mirror)
Welcome to FoxyClasses

LinqPad - C#,VB,F#,SQL,eSQL ... scratchpad
Previous
Reply
Map
View

Click here to load this message in the networking platform