R code iteration blues -
i new r, trying use visualize things. make story short, i'm exploring conjecture have on economic theory of public goods. (i'm in mid 50s, bear me.)
as far r concerned, need create matrix 2 vectors, 1 e(w)/max(w), , 2nd vector stdev(w)/e(w). trick sample space of w, r.v., keeps expanding 1. make clearer, here's probability distribution of w, first 4 iterations:
w p 0 2/3 1 1/3
w p 0 3/6 1 2/6 2 1/6
w p 0 4/10 1 3/10 2 2/10 3 1/10
w p 0 5/15 1 4/15 2 3/15 3 2/15 4 1/15
...
i need iterate 20 times or so. of course, manually, copying, pasting, , manually adjusting simple code, it'd bulky , ugly looking, , i'm bit concerned --- know --- elegance.
with community, learned how program r generate denominator of probabilities:
i thought (foolishly) take there, after few hours scratching bald head, i'm still stuck without knowing how want. it's not understanding how program less simple procedures iterate. :/
i'll appreciate help, clues setting me on right track.
thanks in advance!
you're diving out sum; , sum of 1 k k*(k+1)/2. so...
r>k <- 3 r>k:1 / (k^2 + k)*2
Comments
Post a Comment