Description Usage Arguments Examples
This is a method for print and stanfitExtended
S4 class.
1 2 | ## S4 method for signature 'stanfitExtended'
print(x)
|
x |
An S4 object of class |
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 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 | ## Not run:
# How to use a new method for generic function "print".
#=============================The First Example======================================
#(1)First, we prepare the example data from this package.
dat <- BayesianFROC::dataList.Chakra.1
# The R object named dat is a list which contains the hits and false alarms representing
# an FROC dataset. To confirm it, the function viewdata() can be used;
viewdata(dat)
#(2)Second, we run fit_Bayesian_FROC() in which the rstan::sampling() is implemented.
#Fit to data named "dat" the author's Bayesian model by
fit <- fit_Bayesian_FROC(dat)
#(3)Thirdly, we obtain the R object fit of S4 class
# named stanfitExtended that is an inherited class from the S4 class stanfit
# defined in the package rstan.
# For the S4 class stanfitExtended defined in this package, we can use
# the generic function print for this new S4 class.
print(fit)
# To use the generic functin print() as a object of class "stanfit",
# we coerce class of fit into stanfit from stanfitExtended as follows;
fitt <- methods::as(fit,"stanfit")
# THe R object "fitt" is a fitted model object of class stanfit,
# thus we can also apply the generic function print() as follows:
print(fitt)
#=============================The Second Example======================================
#(1)First, we prepare the example data from this package.
dat <- BayesianFROC::dataList.Chakra.Web
#(2)Second, we run fit_Bayesian_FROC() in which the rstan::sampling() is implemented.
#Fit to data named "dat" the author's Bayesian model by
fit <- fit_Bayesian_FROC(dat)
#(3)Thirdly, we obtain the R object fit of S4 class
# named stanfitExtended that is an inherited class from the S4 class stanfit
# defined in the package rstan.
# For the S4 class stanfitExtended defined in this package, we can use
# the generic function print for this new S4 class.
print(fit)
# 2019.05.21 Revised.
## End(Not run)# dottest
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.