Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #Aufgabe 1 ----
- #(a)----
- N <- 42
- v1 <- 0:N
- r1 <- 0.5^v1
- r2 <- 2*(1-1/(2^(v1+1)))
- #(b)----
- n <- 42
- p <- 1/2
- W <- function(nIn,pIn,i){
- return(choose(nIn,i)*pIn^i*(1-pIn)^(nIn-i))
- }
- P <- function(nIn,pIn,i){
- return(sum(W(n,p,0:i)))
- }
- vW <- W(n,p,0:n)
- vP <- cumsum(W(n,p,0:n)) #Vektor der P_i Werte
- #folgende ignorieren:
- vW1 <- dbinom(0:n,n,p)
- vP1 <- pbinom(0:n,n,p)
- #Aufgabe 2 ----
- x <- c(0.61, 0.79, 0.83, 0.66, 0.94, 0.78, 0.81, 0.60, 0.88, 0.90, 0.75, 0.86, 0.74, 0.84)
- y <- c(1.01, 0.13, 1.73, 0.67, 0.56, 0.99, 0.49, 0.72, 0.13, 0.48, 0.98, 0.08, 1.23 , 0.87)
- x_order=order(x) # (a)----
- paste("x(",1:14,":14) = ",x[order(x)],sep="") # (b)----
- y_coorder <- y[x_order] # (c)----
- paste("(x(",1:14,":14), y[",1:14,":14) = (",x[order(x)],",",y[order(x)],")",sep="") #(d)----
- paste("(x(",format(1:14,justify="right"),":14), y[",format(1:14,justify="right"),":14) = (",format(x[order(x)],digits = 2),",",format(y[order(x)],digits=2),")",sep="") #(e)----
- #Aufgabe 3----
- eruptions <- faithful$eruptions
- wait <- faithful$waiting
- sd(wait)#(a)----
- mean(wait)
- max(wait)
- min(wait)
- (1:length(wait))[wait==max(wait)]#(b)----
- (1:length(wait))[(wait==min(wait))]
- quantile(wait,probs=0.3)#(c)----
- wait[wait<= 60]#(d)----
- length(wait)#(e)----
- length(wait[wait<=60])
- eruptions[wait<=60]#(f)----
- mean(wait[wait<=60])#(g)----
- mean(eruptions[wait<=60])
- sum(eruptions[wait<=60]>=2.5)#(h)----
- plot(wait,eruptions)#(i)----
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement