Hi there,

I have two questions and believe that there is an extremely easy solution.
Being a beginner with R makes thinks a bit more complicated.

This is the code:

rpois(15,3)
n<-15
DATA<-cbind(D,rpois(15,3))

data<-as.data.frame(DATA)

colnames(data)<-c("D","X")

*# 1. question: is it possible to put the following creation of x in a nicer
form?*

x<-c(sum(D>0),sum(D>0),sum(D>0),sum(D>0),sum(D>0),sum(D>0),sum(D>0),sum(D>0),sum(D>0),sum(D>0))

p1<-seq(0, 1, 0.1)

# Posterior Bernoulli distribution
Bn1<-(p1^x*(1-p1)^(n-x))*choose(n,x)
bn1<-as.data.frame(Bn1)

# Normalized posterior Bernoulli distribution
f1<-1/sum(bn1)
nbn1<-bn1*f1
nbn1

# Control check that sum is equal to 1
sum(nbn1)

*# 2. question: how can I calculate cumulative values for nbn1 distribution?
Was looking for the answer on-line but couldn't find anything.*

Your help will be greatly appreciated!!

Good day to all of you

Ana

        [[alternative HTML version deleted]]

______________________________________________
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.

Reply via email to