简体   繁体   中英

Programming include inequality (R)

These is what i did, given h = 5 and get the value of ARL=2.5.

C=[1,5,8,9,7,8,1,2,5,5]
h=5
n=10
ooc=C>h
lenOOC = sum(ooc)
lenOOC
>4
p=lenOOC/n
p
>0.4
ARL=1/p
ARL
>2.5

But now i need is given the value of ARL and compute the value of h=? for example, with same data set of C.

ARL=1.428571
n=10
lenOOC=n/ARL
lenOOC
>7...

and how to proceed to get the value of h? given ooc=C>h .

Hope you all can understand what im trying to ask.. Thanks for helping..=]]

lenOOC=n/ARL You want h so that lenOOC = sum(C>h) . that is you want to find a number h so that lenOOC of the numbers are strictly bigger than h . That is the same as n - lenOOC are less than or equal to h so you want the n - lenOOC biggest number. Just sort the numbers in C and pick the n - lenOOC biggest number.

C=c(1,5,8,9,7,8,1,2,5,5)
ARL=1.428571
n=10
lenOOC=n/ARL
sort(C)[n - round(lenOOC)]
[1] 2

So h = 2.

But notice that this will not work for all values of ARL. What if we tried ARL = 10/9 = 1.1111111 This would give

ARL=1.111111
lenOOC=n/ARL
sort(C)[n - round(lenOOC)]
[1] 1

But h=1 would actually give ARL = 1.25 No number will give ARL=1.111111. The above method only works for possible values of ARL.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM