boundary: Boundary Sampling Method

Description Usage Arguments Details Value Warning See Also Examples

Description

This function enables the visual analysis of the confidence sets generated by the likelihood function by creating a sample of targeted parameters from a confidence distribution.

Usage

1
boundary(model, y, fit, target, targetvalue, cov, B, max_B, ...)

Arguments

model

model of the targeted analysis. Current available models are: Gaussian Regression, Poisson Regression, Logistic Regression, Negative Binomial Regression and Gamma Regression (both inverse and log).

y

response variables

fit

basic statistics after fitting the model by R. Most of the model fits are available in GLM family. If the model cannot be fitted automatically, user must provide at least the list of response variable, design(X) matrix, maximum likelihood estimators, maximum log-likelihood value, and the inference function.

target

should the generated sample be based on confidence level (target <- "level") or confidence ratio (target <- "ratio")? Users can define their own target by specifying target <- "customized" and then need to provide the target confidence level or ratio (using targetvalue argument) and corresponding critical values (using optional argument, cvalue).

targetvalue

the numerical confidence level/ratio. This quantity can be a vector.

cov

the covariance matrix of the model. System will use the default covariance matrix, unless given by user.

B

number of rays to be generated.

max_B

maximum number of rays to be generated for each parameter. Default value is 1000.

...

further arguments to be passed down.

Details

The method generates a sample of parameters from a confidence distribution, which is designed so that its probabilities on the parameters are equal to the asymptotic coverage probabilities of the targeted confidence sets.

For certain models, the covariance matrix, cov includes the mean square error of the model. For instance, Gaussian Regression. These models will have different covariance matrices, which contains only the MLE.

The number of rays generated is equal to the number of samples generated under one confidence level/ratio.

Value

MLE

the maximum likelihood estimators of the model

diagnosis

how many times does the ray generated intersects the boundary. They are categorized as “0”, “1”, “2” and “>2”. Each confidence level is displayed separately.

boundary.sample

the generated samples by boundary sampling method

WaldBoundary.sample

Wald boundary samples

ray.z

the randomly generated multivariate normal values

numWald.interval

1-dimensional numerical Wald intervals transformed from p-dimension for each desired targetvalue

simLik.interval

1-dimensional simulated confidence intervals transformed from p-dimension for each desired targetvalue

convnumWald

convergence diagnosis: 95% numerical Wald intervals for each parameter

convsimuWald

convergence diagnosis: simulated confidence intervals for each parameter

Warning

If target is defined to be "customized", critical values (cvalue) has to be specified by the user. It can be done by boundary(...,target="customized",cvalue=cvalue). This argument is optional, so it can be ignored when target is not "customized".

See Also

independent for independent sampling method. Mgaussian for gaussian regression. Mpoisson for log-linear regression. Mlogistic for logistic regression. Mgamma for gamma regression.

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
library(MASS)
data(data.poisson)
Device <- data.poisson$Device
DataPlan <- data.poisson$DataPlan
y <- data.poisson$y
fit <- glm(y ~ (Device+DataPlan), family=poisson)
target <- "level"
targetvalue <- c(0.5,0.9)    # targeted confidence level

out_b <- boundary("Mpoisson",y,fit,target,targetvalue,B=1000)    # Simulation with desired number of rays

out_b <- boundary("Mpoisson",y,fit,target,targetvalue)    # Simulation without defining B

out_b$diag    # out_b$diag is equivalent to out_b$diagnosis
out_b$bound[1:20,]    # out_b$bound is equivalent to out_b$boundary.sample
out_b$num    # out_b$num is equivalent to out_b$numWald.interval
out_b$sim    # out_b$sim is equivalent to out_b$simWald.interval
out_b$convnum   # out_b$convnum is equivalent to out_b$convnumWald
out_b$convsim   # out_b$convsim is equivalent to out_b$convsimWald

## Visualization
par(mfrow=c(2,2))
plot(out_b$bound[,7]~out_b$bound[,6],
xlab=expression(beta[1]),ylab=expression(beta[2]),cex=0.5)
points(out_b$MLE[2],out_b$MLE[3],pch=16,col="red",cex=1.5)
plot(out_b$bound[,6]~out_b$bound[,5],
xlab=expression(beta[0]),ylab=expression(beta[1]),cex=0.5)
points(out_b$MLE[1],out_b$MLE[2],pch=16,col="red",cex=1.5)
plot(out_b$bound[,7]~out_b$bound[,5],
xlab=expression(beta[0]),ylab=expression(beta[2]),cex=0.5)
points(out_b$MLE[1],out_b$MLE[3],pch=16,col="red",cex=1.5)

ppham27/setsim documentation built on May 25, 2019, 11:25 a.m.