Learn R Programming

ACSWR (version 1.0)

bs: Simulated Sample from Binomial Distribution

Description

The data set is used to understand the sampling variation of the score function. The simulated data is available in Pawitan (2001).

Usage

data(bs)

Arguments

Format

A data frame with 10 observations on the following 20 variables.
Sample.1
a numeric vector
Sample.2
a numeric vector
Sample.3
a numeric vector
Sample.4
a numeric vector
Sample.5
a numeric vector
Sample.6
a numeric vector
Sample.7
a numeric vector
Sample.8
a numeric vector
Sample.9
a numeric vector
Sample.10
a numeric vector
Sample.11
a numeric vector
Sample.12
a numeric vector
Sample.13
a numeric vector
Sample.14
a numeric vector
Sample.15
a numeric vector
Sample.16
a numeric vector
Sample.17
a numeric vector
Sample.18
a numeric vector
Sample.19
a numeric vector
Sample.20
a numeric vector

Source

Pawitan, Y. (2001). In All Likelihood. Oxford Science Publications.

References

Pawitan, Y. (2001). In All Likelihood. Oxford Science Publications.

Examples

Run this code
data(bs)
n <- 10
sample_means <- colMeans(bs)
binomial_score_fn <- function(p,xbar)
      n*(xbar-10*p)/(p*(1-p))
p <- seq(from=0,to=1,by=0.02)
plot(p,sapply(p,binomial_score_fn,xbar=sample_means[1]),"l",xlab=expression(p),
ylab=expression(S(p)))
title(main="C: Score Function Plot of Binomial Model")
for(i in 2:20) lines(p,sapply(p,
binomial_score_fn,xbar=sample_means[i]),"l")
abline(v=4)
abline(h=0)

Run the code above in your browser using DataLab