independent: Independent Sampling Method

Description Usage Arguments Details Value 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
independent(model, y, fit, 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 values, and the inference function.

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.

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.

Value

MLE

the maximum likelihood estimators of the model

max_loglik

the maximum value of the log-likelihood function

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.

independent.sample

the generated samples by boundary sampling method.

ray.z

the randomly generated multivariate normal values.

numWald.interval

numerical Wald intervals for each maximum likelihood estimator.

simWald.interval

simulated Wald intervals for each maximum likelihood estimator.

See Also

boundary for boundary sampling method. Mgaussian for gaussian regression. Mpoisson for poisson/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
library(MASS)
data(data.poisson)
Device <- data.poisson$Device
DataPlan <- data.poisson$DataPlan
y <- data.poisson$y
fit <- glm(y ~ (Device+DataPlan), family=poisson)

out_i <- independent("Mpoisson",y,fit,B=1000)    # Simulation with desired number of rays
out_i <- independent("Mpoisson",y,fit)    # Simulation without defining B

out_i$diag    # out_i$diag is equivalent to out_i$diagnosis
out_i$ind[100:140,]    # out_i$ind is equivalent to out_i$independent.sample
out_i$num    #out_i$num is equivalent to out_i$numWald.interval
out_i$sim    #out_i$sim is equivalent to out_i$simWald.interval

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

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