mle: Maximum Likelihood Estimation of Incomplete Multinomial Model

Description Usage Arguments Value Author(s) Examples

Description

Find the Maximum Likelihood Estimate and its Asymptotic Covariance of an imultinom S4 object

Usage

1
  mle(x)

Arguments

x

This is an imultinom S4 object. The function also reads the following global options for iteration related settings.
getOption("tolerance"), can be set by options(tolerance=1e-15), if you want a finer tolerance other than the default 1e-10
getOption("iterrec"), can be set by options(iterrec = TRUE) if you want to turn on iteration recording.
getOption("maxit"), can be set by options(maxit=1000) if the default 500 maximum iteration steps is insufficient.
getOption("PriorThickness"), can be set by options(PriorThickness=1000). This parameter is only for weaver.bayes, and it requires some skills to set.

Value

Returns $x as the MLE, $obs.info.mat as the asymptotic covariance matrix of the MLE, along with other iteration details.

Author(s)

Fanghu Dong <easttiger@gmail.com>

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
obj1_imultinom <- imultinom(a=c(3,3,3),b=c(2,9),De = matrix(c(1,0,1,1,1,0),ncol=2))
mle(obj1_imultinom)

cat ("Press [enter] to continue"); line <- readline()
options(iterrec=T)
cat("\n=================\n")
subject = "MLE of Ford (1957) adjacency matrix format"
cat(c(subject,"\n"))
Ford1957_adjmat = matrix(
	c( 0,15,15, 0,
	  11, 0,10,20,
	  11,10, 0,20,
	   0, 1, 1, 0),
	nrow = 4,
	byrow=TRUE);

Ford1957 <- imultinom(matrixInput = Ford1957_adjmat)
Ford1957_out <- mle(Ford1957)
if(!is.null(getOption("iterrec")) && getOption("iterrec")){
  with(Ford1957_out, print(list(x=x,iterCount=iter$count,lnLik=iter$lnLik[iter$count])))
  plot(Ford1957_out$iter$lnLik, type="b",pch=20,main=subject)
}else{
  print(Ford1957_out)
}

cat ("Press [enter] to continue"); line <- readline()
cat("\n=================\n")
subject = "MLE of Hunter (2004) NASCAR2002 Plackett-Luce Modelling"
cat(c(subject,"\n"))
nascar2002PL <- imultinom(Weaver.Examples.Hunter2004PL.ConvertInput())
nascar2002PL_out = mle(nascar2002PL)
if(!is.null(getOption("iterrec")) && getOption("iterrec")){
  with(nascar2002PL_out, print(list(x=x,iterCount=iter$count,lnLik=iter$lnLik[iter$count])))
  plot(nascar2002PL_out$iter$lnLik, type="b",pch=20,main=subject)
}else{
  print(nascar2002PL_out)
}

cat ("Press [enter] to continue"); line <- readline()
cat("\n=================\n")
subject = "MLE of Hunter (2004) NASCAR2002 Bradley-Terry Modelling"
cat(c(subject,"\n"))
data(nascar2002BT)
nascar2002BT_out = mle(nascar2002BT)
if(!is.null(getOption("iterrec")) && getOption("iterrec")){
  with(nascar2002BT_out, print(list(x=x,iterCount=iter$count,lnLik=iter$lnLik[iter$count])))
  plot(nascar2002BT_out$iter$lnLik, type="b",pch=20,main=subject)
}else{
  print(nascar2002BT_out)
}

cat ("Press [enter] to continue"); line <- readline()
cat("\n=================\n")
subject = "MLE of Hankin (2010) Volleyball dataset";
cat(c(subject,"\n"))
Hankin2010 = imultinom(Weaver.Examples.Hankin2010Volleyball.ConvertInput())
Hankin2010_out = mle(Hankin2010)
if(!is.null(getOption("iterrec")) && getOption("iterrec")){
  with(Hankin2010_out, print(list(x=x,iterCount=iter$count,lnLik=iter$lnLik[iter$count])))
  plot(Hankin2010_out$iter$lnLik, type="b",pch=20,main=subject)
}else{
  print(Hankin2010_out)
}
options(iterrec=F)

easttiger/imultinom documentation built on May 15, 2019, 7:28 p.m.