bsnb: Calculate Bootstrap Estimates and Confidence Intervals for...

Description Usage Arguments Value Note References See Also Examples

Description

Uses the parametric bootstrap to estimate the bias and confidence interval of the MLE of the Negative Binomial Distribution.

Usage

1
2
3
4
bsnb(x, cutoff=1, m=200, np=2, alpha=0.95, hellinger=FALSE)
bootstrapnb(x,cutoff=1,cutabove=1000,
                          m=200,alpha=0.95,guess=c(5, 0.2),
                          file="none")

Arguments

x

A vector of counts (one per observation).

cutoff

Calculate estimates conditional on exceeding this value.

m

Number of bootstrap samples to draw.

np

Number of parameters in the model (1 by default).

alpha

Type I error for the confidence interval.

hellinger

Minimize Hellinger distance of the parametric model from the data instead of maximizing the likelihood.

cutabove

Calculate estimates conditional on not exceeding this value.

guess

Guess at the parameter value.

file

Name of the file to store the results. By default do not save the results.

Value

dist

matrix of sample CDFs, one per row.

obsmle

The Negative Binomial MLE of the PDF exponent.

bsmles

Vector of bootstrap MLE.

quantiles

Quantiles of the bootstrap MLEs.

pvalue

p-value of the Anderson-Darling statistics relative to the bootstrap MLEs.

obsmands

Observed Anderson-Darling Statistic.

meanmles

Mean of the bootstrap MLEs.

guess

Initial estimate at the MLE.

mle.meth

Method to use to compute the MLE.

Note

See the working papers on http://www.csss.washington.edu/Papers for details

References

Jones, J. H. and Handcock, M. S. "An assessment of preferential attachment as a mechanism for human sexual network formation," Proceedings of the Royal Society, B, 2003, 270, 1123-1128.

See Also

anbmle, simnb, llnb

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
# Now, simulate a Negative Binomial distribution over 100
# observations with expected count 1 and probability of another
# of 0.2

set.seed(1)
s4 <- simnb(n=100, v=c(5,0.2))
table(s4)

#
# Calculate the MLE and an asymptotic confidence
# interval for the parameter.
#

s4est <- anbmle(s4)
s4est

#
# Use the bootstrap to compute a confidence interval rather than using the 
# asymptotic confidence interval for the parameter.
#

bsnb(s4, m=20)

Example output

degreenet: Models for Skewed Count Distributions Relevant to Networks
Version 1.3-1 created on 2015-04-03.
copyright (c) 2013, Mark S. Handcock, University of California - Los Angeles
 Based on "statnet" project software (statnet.org).
 For license and citation information see statnet.org/attribution
 For citation information, type citation("degreenet").
 Type help("degreenet-package") to get started.

s4
 1  2  3  4  5  6  7  8  9 10 11 13 15 22 
13 18 19  6 10  7  8  5  3  4  3  2  1  1 
$theta
expected stop   prob 1 stop 
    5.4061781     0.2952548 

$asycov
              expected stop prob 1 stop
expected stop    0.26818893 0.008947170
prob 1 stop      0.00894717 0.002380622

$se
expected stop   prob 1 stop 
   0.51786960    0.04879161 

$asycor
              expected stop prob 1 stop
expected stop     1.0000000   0.3540952
prob 1 stop       0.3540952   1.0000000

$npar
gamma mean gamma s.d. 
  3.809978   3.015635 

$value
[1] -243.3129

$dist
       k ecdf       cdf
 [1,]  1 0.13 0.1426686
 [2,]  2 0.31 0.3031585
 [3,]  3 0.50 0.4499795
 [4,]  4 0.56 0.5740141
 [5,]  5 0.66 0.6744558
 [6,]  6 0.73 0.7536820
 [7,]  7 0.81 0.8150645
 [8,]  8 0.86 0.8620078
 [9,]  9 0.89 0.8975565
[10,] 10 0.93 0.9242688
[11,] 11 0.96 0.9442166
[12,] 12 0.96 0.9590366
[13,] 13 0.98 0.9699999
[14,] 14 0.98 0.9780805
[15,] 15 0.99 0.9840178
[16,] 16 0.99 0.9883684
[17,] 17 0.99 0.9915488
[18,] 18 0.99 0.9938687
[19,] 19 0.99 0.9955578
[20,] 20 0.99 0.9967855
[21,] 21 0.99 0.9976766
[22,] 22 1.00 0.9983223

$obsmle
expected stop   prob 1 stop 
    5.4061781     0.2952548 

$bsmles
   expected count Prob. of a stop     MANDS
1        5.860282       0.3395968 0.2749075
2        4.710183       0.3227363 0.5975726
3        5.011708       0.2197579 0.1101466
4        5.272830       0.2565647 0.2108935
5        5.329687       0.2626062 0.4195867
6        5.138825       0.2780451 0.3595253
7        5.403790       0.3060229 0.1468062
8        5.140102       0.2509880 0.2890664
9        5.296039       0.2541640 0.2794547
10       5.275147       0.3004926 0.2280862
11       4.494470       0.2857757 0.5600244
12       4.826155       0.2540698 0.3693514
13       5.314602       0.3433304 0.2262835
14       4.709533       0.2504565 0.3310171
15       5.956346       0.3081450 0.6170759
16       5.670075       0.2522076 0.2585707
17       5.123118       0.3129197 0.4890570
18       5.500189       0.2690994 0.1866024
19       5.397523       0.2978063 0.2197814
20       5.270838       0.3302825 0.3297978

$quantiles
     2.5%       50%     97.5% 
0.1275599 0.2842606 0.6078119 

$pvalue
[1] 0.6190476

$obsmands
[1] 0.2396298

$meanmles
 expected count Prob. of a stop           MANDS 
      5.2350720       0.2847534       0.3251804 

degreenet documentation built on May 1, 2019, 8:08 p.m.