Description Usage Arguments Details Examples
This function is a private function that returns the basic statistics of a selected model. It is only used in conjunction with boundary
or independent
sampling method.
1 |
y |
response variables. |
fit |
basic statistics after fitting a linear model by class |
cov |
a covariance matrix of the parameters. System will use default covariance matrix if it is not specified. |
Both "log" link and "inverse" link are available in the system. The link information is stored in argument "fit" when the "lm" class is created.
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 | ## Not run:
#############################################################
################-----IndependentSampling-----################
#############################################################
#########Log Link#########
library(MASS)
data(data.loggamma)
x <- log(data.loggamma$Brain)
y <- data.loggamma$Body
fit <- glm(y ~ x, family = Gamma(link = "log"))
#########Inverse Link#########
library(MASS)
data(data.inversegamma)
attach(data.inversegamma)
x <- log(data.inversegamma$Time)
y <- data.inversegamma$Plasma
fit <- glm(y ~ x, family = Gamma(link = "inverse"))
########################################################
out_i <- independent("Mgamma",y,fit,B=1000)
########################################################
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
########################################################
par(mfrow=c(2,2),pty = "s")
plot(out_i$ind[,5],out_i$ind[,6],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[,5],out_i$ind[,7],xlab=expression(beta[0]),ylab=expression(nu),cex=0.5)
points(out_i$MLE[1],out_i$MLE[3],pch=16,col="red",cex=1.5)
plot(out_i$ind[,6],out_i$ind[,7],xlab=expression(beta[1]),ylab=expression(nu),cex=0.5)
points(out_i$MLE[2],out_i$MLE[3],pch=16,col="red",cex=1.5)
##########################################################
################-----BoundarySampling-----################
##########################################################
#########Log Link#########
library(MASS)
data(data.loggamma)
x <- log(data.loggamma$Brain)
y <- data.loggamma$Body
fit <- glm(y ~ x, family = Gamma(link = "log"))
target <- "level"
targetvalue <- c(0.5,0.9)
#########Inverse Link#########
library(MASS)
data(data.inversegamma)
x <- log(data.inversegamma$Time)
y <- data.inversegamma$Plasma
fit <- glm(y ~ x, family = Gamma(link = "inverse"))
target <- "level"
targetvalue <- c(0.5,0.9)
########################################################
out_b <- boundary("Mgamma",y,fit,target,targetvalue,B=1000)
########################################################
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
########################################################
par(mfrow=c(2,2))
plot(out_b$bound[,5],out_b$bound[,6],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[,5],out_b$bound[,7],xlab=expression(beta[0]),ylab=expression(nu),cex=0.5)
points(out_b$MLE[1],out_b$MLE[3],pch=16,col="red",cex=1.5)
plot(out_b$bound[,6],out_b$bound[,7],xlab=expression(beta[1]),ylab=expression(nu),cex=0.5)
points(out_b$MLE[2],out_b$MLE[3],pch=16,col="red",cex=1.5)
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.