Ablinev1645lty2

Some points should be made: The expression "0:n1", which appears in the second line, is a shorter way of writing "seq(from=0,to=n1,by=1)". It produces, in this case, the set of values that the binomial random variable may have. Consider next the application of the "plot" function. Observe that the function "dbinom", which produces the binomial density, was applied. The argument "h" in "type" produces vertical, histogram-like, lines. Colors are set with the aid of the argument "col". The simplest way to assign values to this argument is by introducing the color's name. For example, one may write "col="red"". Alternatively, color number codes can be used. For technical reasons we will produce in this book only black and white plots. Hence we will apply the function "gray", which produces levels of gray. The input to the function is the level - a number between zero and one. The argument "main" produces the title of the plot. It takes as values character strings. Such strings may be entered directly or as outputs of string-manipulating functions. The former approach is applied in the argument "xlab="z"", which adds the title to the x axis. For the main title the function "paste" is used. This function takes as input character strings and pastes them together. If the input is numerical it is translated, first to a character string representation of the number. In this example the output of the function is

0 0

Post a comment