Last data update: 2014.03.03

R: Simulated Sample from Poisson Distribution
psR Documentation

Simulated Sample from Poisson 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(ps)

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

data(ps)
n <- 10
sample_means <- colMeans(ps)
poisson_score_fn <- function(theta,xbar) n*(xbar-theta)/theta
theta <- seq(from=2,to=8,by=0.2)
plot(theta,sapply(theta,poisson_score_fn,xbar=sample_means[1]),"l",xlab=
  expression(lambda),ylab=expression(S(lambda)),ylim=c(-5,15))
title(main="B: Score Function Plot of the Poisson Model")
for(i in 2:20) 
lines(theta,sapply(theta,poisson_score_fn,xbar=sample_means[i]),"l")
abline(v=4)
abline(h=0)

Results


R version 3.3.1 (2016-06-21) -- "Bug in Your Hair"
Copyright (C) 2016 The R Foundation for Statistical Computing
Platform: x86_64-pc-linux-gnu (64-bit)

R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.

R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.

Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.

> library(ACSWR)
> png(filename="/home/ddbj/snapshot/RGM3/R_CC/result/ACSWR/ps.Rd_%03d_medium.png", width=480, height=480)
> ### Name: ps
> ### Title: Simulated Sample from Poisson Distribution
> ### Aliases: ps
> ### Keywords: maximum likelihood estimator
> 
> ### ** Examples
> 
> data(ps)
> n <- 10
> sample_means <- colMeans(ps)
> poisson_score_fn <- function(theta,xbar) n*(xbar-theta)/theta
> theta <- seq(from=2,to=8,by=0.2)
> plot(theta,sapply(theta,poisson_score_fn,xbar=sample_means[1]),"l",xlab=
+   expression(lambda),ylab=expression(S(lambda)),ylim=c(-5,15))
> title(main="B: Score Function Plot of the Poisson Model")
> for(i in 2:20) 
+ lines(theta,sapply(theta,poisson_score_fn,xbar=sample_means[i]),"l")
> abline(v=4)
> abline(h=0)
> 
> 
> 
> 
> dev.off()
null device 
          1 
>