Unformatted text preview: avoid any confusion, I have written a function in R called dgeo which will calculate probabilities for the geometric distribution that will match your textbook. Before you use R to calculate the probabilities for the geometric distribution, you need to type in the following function. dgeo< function(y,p){p*(1p)^(y1)} To Fnd a probability P ( Y = y ) = p ( y ) for a single value y , the command in R is dgeo(y,p) To Fnd the probability P ( Y ≤ y ), use the sum command to add up all p ( y ) values for y between and including 1 and y . sum(dgeo(1:y,p)) To Fnd the probability P ( y 1 ≤ Y ≤ y 2 ), use the sum command to add up all p ( y ) values for y between and including y 1 and y 2 . sum(dgeo(y1:y2,p)) To Fnd the probability P ( Y ≥ y ) = 1P ( Y < y ) = 1P ( Y ≤ y1), use the sum command to Fnd P ( Y ≤ y1) and subtract this value from 1. 1  sum(dgeo(1:y1,p)) 1...
View
Full
Document
This note was uploaded on 01/27/2010 for the course STAT 342 taught by Professor Staff during the Spring '08 term at Iowa State.
 Spring '08
 Staff
 Probability

Click to edit the document details