Skip to content

probability from different values

4 messages · Richard Cotton, Matthias Kohl

#
Try this:
A = c(18,18,18,19,20,21,22,23,24,25,26,27,28)
B = c(82,83,84,85,85,86,87,88,89,90,91,91,92)
lenA = length(A)
lenB = length(B)
AA = rep(A, lenB)
BB = rep(B, each=lenA)
table(AA-BB)/(lenA*lenB)

Regards,
Richie.

Mathematical Sciences Unit
HSL


------------------------------------------------------------------------
ATTENTION:

This message contains privileged and confidential inform...{{dropped:20}}
#
Hello Ricardo,

another solution could be using package distr:

library(distr)
A <- c(18,18,18,19,20,21,22,23,24,25,26,27,28)
DA <- DiscreteDistribution(A)
# maybe
# support(DA)
# plot (DA)

B <- c(82,83,84,85,85,86,87,88,89,90,91,91,92)
DB <- DiscreteDistribution(B)
# support(DB)
# plot(DB)

DC <- DB - DA# convolution with of DB with (-DA)
# support(DC)
# plot(DC)

hth,
Matthias
Richard.Cotton at hsl.gov.uk wrote:
#
one addition ...
to get the probabilities for the C-values:
p(DC)(support(DC))
#
Matthias Kohl wrote:
sorry, I meant
d(DC)(support(DC))