[R] Loop

kerry1912 kerry1912 at hotmail.com
Mon Feb 27 10:52:19 CET 2012


I've tried to create a loop for the following code but have failed miserably. 

This is what the code is:

pnorm((Normal.Team.LnAveragePPPConceded.LnAveragePPPScores.HA.pred[1,1]
-Normal.Team.LnAveragePPPConceded.LnAveragePPPScores.HA.pred[50,1])/
sqrt(prediction.SE[1]^2 + prediction.SE[50]^2))

I'd like a loop so that it is something like this:

for (i in 1:50) {
pnorm((Normal.Team.LnAveragePPPConceded.LnAveragePPPScores.HA.pred[i,1]
-Normal.Team.LnAveragePPPConceded.LnAveragePPPScores.HA.pred[i+49,1])/
sqrt(prediction.SE[i]^2 + prediction.SE[i+49]^2))
}

Many thanks

--
View this message in context: http://r.789695.n4.nabble.com/Loop-tp4424128p4424128.html
Sent from the R help mailing list archive at Nabble.com.



More information about the R-help mailing list