[R] Very simple loop

2011-11-14 Thread Davg
I'm very new to R and am trying to create my first loop.

I have:

x <-c(0:200)
A <- dpois(x,exp(4.5355343))
B <- dpois(x,exp(4.5355343 + 0.0118638))
C <- dpois(x,exp(4.5355343  -0.0234615))
D <- dpois(x,exp(4.5355343 + 0.0316557))
E <- dpois(x,exp(4.5355343 + 0.0004716))
F <- dpois(x,exp(4.5355343 + 0.056437))
G <- dpois(x,exp(4.5355343 + 0.1225822))

and would like to to get A[K] + B[K] + C[K] + D[K] + E[K] + F[K] G[K]
for K(0:200)

And then plot these cumulative values.

Many thanks.


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

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Very simple loop

2011-11-14 Thread Davg
Thank you all!

It's working perfectly.  I will have a look for an online guide.

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

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] Comparing negative binomial models

2011-11-03 Thread Davg
Hi,

I am trying to compare negative binomial models for the prediction of sports
games (I know that Poisson models would be better but I'm just trying
Negative Binomial at the moment).

But, to compare the models I need them to have the same theta value.  How
can I change the explanatory variables while maintaining the theta value?

Thanks for the help.

David 

--
View this message in context: 
http://r.789695.n4.nabble.com/Comparing-negative-binomial-models-tp3985353p3985353.html
Sent from the R help mailing list archive at Nabble.com.

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] Predict function

2012-02-02 Thread Davg
I've created a linear model and am trying to use the predict function to
predict the outcome of a sports game.

I have four explanatory variables a,b,c,d.  where a,b relate to the home
team and c,d relate to the away team.

i'd like to know the probability  that the home team wins (assuming no
draws).

Many thanks

David

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

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.