[R] conditional probability removal
Rui Barradas
ruipbarradas at sapo.pt
Thu Apr 17 22:33:31 CEST 2014
Hello,
The discussion in that thread applies, maybe with
prob <- 1L + (dat >= 5) + (dat >= 8)
Hope this helps,
Rui Barradas
Em 17-04-2014 21:17, Boris Steipe escreveu:
> I think the discussion in this thread
> https://stat.ethz.ch/pipermail/r-help/2014-April/368816.html
> applies exactly.
>
> See the parameter "prob" of sample.
>
> Cheers,
> B.
>
>
> On 2014-04-17, at 4:07 PM, Charles Determan Jr wrote:
>
>> Greetings,
>>
>> I would like to randomly remove elements from a numeric vector but with
>> different probabilities for higher numbers.
>>
>> For example:
>>
>> dat <- sample(seq(10), 100, replace=T)
>>
>> # now I would like to say randomly remove elements but with a higher chance
>> of removing elements >= 5 and even greater for elements >= 8.
>>
>> I am unfamiliar if there is a way to define conditional probabilities. Any
>> insight would be appreciated.
>>
>> Regards,
>> Charles
>>
>> [[alternative HTML version deleted]]
>>
>> ______________________________________________
>> R-help at r-project.org mailing list
>> https://stat.ethz.ch/mailman/listinfo/r-help
>> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
>> and provide commented, minimal, self-contained, reproducible code.
>
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>
More information about the R-help
mailing list