Quantcast
Channel: Active questions tagged r - Stack Overflow
Viewing all articles
Browse latest Browse all 201839

Is there a function in R for discrete probability distribution?

$
0
0

I have a set of Bernoulli variables, giving specific values with different probabilities. The variables are independent. I'm trying to build a simple discrete probability table for all the possible outcomes. A short example of the data I have is:

# A tibble: 2 x 4
  `test number`  prob value `no-value`
          <dbl> <dbl> <dbl>      <dbl>
1             1   0.7   1.7        0.3
2             2   0.6   1.5        0.6

and the solution I'm trying to find is:

# A tibble: 1 x 5
  value       `3.2` `2.299999999999999~ `1.8` `0.8999999999999999~
  <chr>       <dbl>               <dbl> <dbl>                <dbl>
1 probability  0.42               0.280  0.18                 0.12

Where the value is the sum of the possible values and the probability is the probability of this value.


Viewing all articles
Browse latest Browse all 201839

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>