
Hi all,
I tried to run the following code, but at the end it says 'Error in k[, 1] : incorrect number of dimensions'. I just copypaste this code and have no experience on programming. Can any one tell me what's wrong and how to fix it? Thanks in advance!
x < rbinom(1000, 8, 0.5)
y < rbinom(1000, 8, 0.5)
k < c(rep(0:8, times=9), rep(0:8, each=9))
K < matrix(k, ncol = 2, byrow = FALSE)
z < k[, 1] + k[, 2]
cdf < rep(0.0, times = 81)
for(i in 1:81) {cdf[i] < sum(x+y <= z[i])/1000}
scatterplot3d(k[, 1], k[, 2], cdf, highlight.3d = TRUE, col.axis = 'blue',
mian='Plotting bivariate CDF', pch = 20, ylab = 'values of y', xlab = 'values of x',
zlab = 'CDF of x+y')
