s2_estimatePhi: Initialization of Phi (Generic)

Description Usage Arguments Details Value Author(s) References See Also Examples

Description

This generic function estimates Phi (expression value) either by posterior mean (PM) or by maximum likelihood estimator (MLE) depending on options set by init.function().

Usage

1
2
3
4
5
  estimatePhi(fitlist, reu13.list, y.list, n.list,
    E.Phi = .CF.OP$E.Phi, lower.optim = .CF.OP$lower.optim,
    upper.optim = .CF.OP$upper.optim,
    lower.integrate = .CF.OP$lower.integrate,
    upper.integrate = .CF.OP$upper.integrate, control = list())

Arguments

fitlist

an object of format b.

reu13.list

an object of format reu13.list.

y.list

an object of format y.list.

n.list

an object of format n.list.

E.Phi

potential expected value of Phi.

lower.optim

lower bound to optim().

upper.optim

upper bound to optim().

lower.integrate

lower bound to integrate().

upper.integrate

upper bound to integrate().

control

control options to optim().

Details

estimatePhi() is a generic function first initialized by init.function(), then it estimates Phi accordingly. By default, .CF.CT$init.Phi sets the method PM for the posterior mean.

PM uses a flat prior and integrate() to estimate Phi. While, MLE uses optim() to estimate Phi which may have boundary solutions for some sequences.

Value

Estimated Phi for every sequence is returned.

Author(s)

Wei-Chen Chen wccsnow@gmail.com.

References

https://github.com/snoweye/cubfits/

See Also

init.function() and fitMultinom().

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
## Not run: 
suppressMessages(library(cubfits, quietly = TRUE))
set.seed(1234)

# Convert data.
reu13.list <- convert.reu13.df.to.list(ex.test$reu13.df)
y.list <- convert.y.to.list(ex.test$y)
n.list <- convert.n.to.list(ex.test$n)

# Get phi.pred.Init
init.function(model = "roc")
fitlist <- fitMultinom(ex.train$reu13.df, ex.train$phi.Obs, ex.train$y, ex.train$n)
phi.pred.Init <- estimatePhi(fitlist, reu13.list, y.list, n.list,
                         E.Phi = median(ex.test$phi.Obs),
                         lower.optim = min(ex.test$phi.Obs) * 0.9,
                         upper.optim = max(ex.test$phi.Obs) * 1.1)

## End(Not run)

cubfits documentation built on Nov. 8, 2021, 1:07 a.m.