source("DBDA2E-utilities.R")
gammaShRaFromMeanSD(mean = 1, sd = 10)
gammaShRaFromModeSD(mode = 1, sd = 10)
layout(matrix(1:3,ncol=1))
k=seq(0,200,length=10001)
plot( k, dgamma(k,1.105125,0.105125), ylab="dgamma(k)",
type="l", main="Gamma Distrib's (SD=10)" )
lines( k, dgamma(k,0.01,0.01), col="skyblue" )
legend( "topright", c("Mode 1","Mean 1"),
lty=c(1,1), col=c("black","skyblue"), text.col=c("black", "skyblue") )
plot( k, dgamma(k,1.105125,0.105125), ylab="dgamma(k)",
type="l", ylim=c(.07,.08), main="Gamma Distrib's (SD=10), zoomed in" )
lines( k, dgamma(k,0.01,0.01), col="skyblue" )
legend( "topright", c("Mode 1","Mean 1"),
lty=c(1,1), col=c("black","skyblue"), text.col=c("black", "skyblue") )
plot( k, dgamma(k,1.105125,0.105125), ylab="dgamma(k)",
type="l", ylim=c(0,8.0e-5), main="Gamma Distrib's (SD=10), zoomed in" )
lines( k, dgamma(k,0.01,0.01), col="skyblue" )
legend( "topright", c("Mode 1","Mean 1"),
lty=c(1,1), col=c("black","skyblue"), text.col=c("black", "skyblue") )
#-------------------------------------------------------------------------------
# Load The data
myData = read.csv("TherapeuticTouchData.csv")
# N.B.: The functions below expect the data to be a data frame,
# with one component named y being a vector of integer 0,1 values,
# and one component named s being a factor of subject identifiers.
#-------------------------------------------------------------------------------
# Load the relevant model into R's working memory:
source("Jags-Ydich-XnomSsubj-MbinomBetaOmegaKappa.R")
startTime = proc.time()
mcmcCoda = genMCMC( data=myData , sName="s" , yName="y" ,
numSavedSteps=20000 , saveName=fileNameRoot ,
thinSteps=10 )
stopTime = proc.time()
show( stopTime-startTime )
#-------------------------------------------------------------------------------
# Optional: Specify filename root and graphical format for saving output.
# Otherwise specify as NULL or leave saveName and saveType arguments
# out of function calls.
fileNameRoot = "Jags-Ydich-XnomSsubj-MbinomBetaOmegaKappa-"
graphFileType = "eps"
# Generate the MCMC chain:
startTime = proc.time()
mcmcCoda = genMCMC( data=myData , sName="s" , yName="y" ,
numSavedSteps=20000 , saveName=fileNameRoot ,
thinSteps=10 )
stopTime = proc.time()
show( stopTime-startTime )
# Display diagnostics of chain, for specified parameters:
parameterNames = varnames(mcmcCoda) # get all parameter names for reference
for ( parName in parameterNames[c(1:3,length(parameterNames))] ) {
diagMCMC( codaObject=mcmcCoda , parName=parName ,
saveName=fileNameRoot , saveType=graphFileType )
}
# Get summary statistics of chain:
summaryInfo = smryMCMC( mcmcCoda , compVal=0.5 ,
diffIdVec=c(1,14,28), compValDiff=0.0,
saveName=fileNameRoot )
# Display posterior information:
plotMCMC( mcmcCoda , data=myData , sName="s" , yName="y" ,
compVal=0.5 , #rope=c(0.45,0.55) ,
diffIdVec=c(1,14,28), compValDiff=0.0, #ropeDiff = c(-0.05,0.05) ,
saveName=fileNameRoot , saveType=graphFileType )
# Example for Jags-Ydich-XnomSsubj-MbinomBetaOmegaKappa.R
#-------------------------------------------------------------------------------
# Optional generic preliminaries:
#graphics.off() # This closes all of R's graphics windows.
rm(list=ls())  # Careful! This clears all of R's memory!
#-------------------------------------------------------------------------------
# Load The data
myData = read.csv("TherapeuticTouchData.csv")
# N.B.: The functions below expect the data to be a data frame,
# with one component named y being a vector of integer 0,1 values,
# and one component named s being a factor of subject identifiers.
#-------------------------------------------------------------------------------
# Load the relevant model into R's working memory:
source("Jags-Ydich-XnomSsubj-MbinomBetaOmegaKappa.R")
#-------------------------------------------------------------------------------
# Optional: Specify filename root and graphical format for saving output.
# Otherwise specify as NULL or leave saveName and saveType arguments
# out of function calls.
fileNameRoot = "Jags-Ydich-XnomSsubj-MbinomBetaOmegaKappa-"
graphFileType = "eps"
#-------------------------------------------------------------------------------
# Generate the MCMC chain:
startTime = proc.time()
mcmcCoda = genMCMC( data=myData , sName="s" , yName="y" ,
numSavedSteps=20000 , saveName=fileNameRoot ,
thinSteps=10 )
stopTime = proc.time()
show( stopTime-startTime )
#-------------------------------------------------------------------------------
# Display diagnostics of chain, for specified parameters:
parameterNames = varnames(mcmcCoda) # get all parameter names for reference
for ( parName in parameterNames[c(1:3,length(parameterNames))] ) {
diagMCMC( codaObject=mcmcCoda , parName=parName ,
saveName=fileNameRoot , saveType=graphFileType )
}
#-------------------------------------------------------------------------------
# Get summary statistics of chain:
summaryInfo = smryMCMC( mcmcCoda , compVal=0.5 ,
diffIdVec=c(1,14,28), compValDiff=0.0,
saveName=fileNameRoot )
# Display posterior information:
plotMCMC( mcmcCoda , data=myData , sName="s" , yName="y" ,
compVal=0.5 , #rope=c(0.45,0.55) ,
diffIdVec=c(1,14,28), compValDiff=0.0, #ropeDiff = c(-0.05,0.05) ,
saveName=fileNameRoot , saveType=graphFileType )
# Example for Jags-Ydich-XnomSsubj-MbinomBetaOmegaKappa.R
#-------------------------------------------------------------------------------
# Optional generic preliminaries:
#graphics.off() # This closes all of R's graphics windows.
rm(list=ls())  # Careful! This clears all of R's memory!
#-------------------------------------------------------------------------------
# Load The data
myData = read.csv("TherapeuticTouchData.csv")
# N.B.: The functions below expect the data to be a data frame,
# with one component named y being a vector of integer 0,1 values,
# and one component named s being a factor of subject identifiers.
#-------------------------------------------------------------------------------
# Load the relevant model into R's working memory:
source("Jags-Ydich-XnomSsubj-MbinomBetaOmegaKappa.R")
#-------------------------------------------------------------------------------
# Optional: Specify filename root and graphical format for saving output.
# Otherwise specify as NULL or leave saveName and saveType arguments
# out of function calls.
fileNameRoot = "Jags-Ydich-XnomSsubj-MbinomBetaOmegaKappa-"
graphFileType = "eps"
#-------------------------------------------------------------------------------
# Generate the MCMC chain:
startTime = proc.time()
mcmcCoda = genMCMC( data=myData , sName="s" , yName="y" ,
numSavedSteps=20000 , saveName=fileNameRoot ,
thinSteps=10 )
stopTime = proc.time()
show( stopTime-startTime )
#-------------------------------------------------------------------------------
# Display diagnostics of chain, for specified parameters:
parameterNames = varnames(mcmcCoda) # get all parameter names for reference
for ( parName in parameterNames[c(1:3,length(parameterNames))] ) {
diagMCMC( codaObject=mcmcCoda , parName=parName ,
saveName=fileNameRoot , saveType=graphFileType )
}
#-------------------------------------------------------------------------------
# Get summary statistics of chain:
summaryInfo = smryMCMC( mcmcCoda , compVal=0.5 ,
diffIdVec=c(1,14,28), compValDiff=0.0,
saveName=fileNameRoot )
# Display posterior information:
plotMCMC( mcmcCoda , data=myData , sName="s" , yName="y" ,
compVal=0.5 , #rope=c(0.45,0.55) ,
diffIdVec=c(1,14,28), compValDiff=0.0, #ropeDiff = c(-0.05,0.05) ,
saveName=fileNameRoot , saveType=graphFileType )
#-------------------------------------------------------------------------------
# Display posterior information:
plotMCMC( mcmcCoda , data=myData , sName="s" , yName="y" ,
compVal=0.5 , #rope=c(0.45,0.55) ,
diffIdVec=c(1,14,28), compValDiff=0.0, #ropeDiff = c(-0.05,0.05) ,
saveName=fileNameRoot , saveType=graphFileType )
#-------------------------------------------------------------------------------
# Display posterior information:
plotMCMC( mcmcCoda , data=myData , sName="s" , yName="y" ,
compVal=0.5 , #rope=c(0.45,0.55) ,
diffIdVec=c(1,14,28), compValDiff=0.0, #ropeDiff = c(-0.05,0.05) ,
saveName=fileNameRoot , saveType=graphFileType )
#-------------------------------------------------------------------------------
# Display posterior information:
plotMCMC( mcmcCoda , data=myData , sName="s" , yName="y" ,
compVal=0.5 , #rope=c(0.45,0.55) ,
diffIdVec=c(1,14,28), compValDiff=0.0, #ropeDiff = c(-0.05,0.05) ,
saveName=fileNameRoot , saveType=graphFileType )
#-------------------------------------------------------------------------------
# Example for Jags-Ydich-XnomSsubj-MbinomBetaOmegaKappa.R
#-------------------------------------------------------------------------------
# Optional generic preliminaries:
#graphics.off() # This closes all of R's graphics windows.
rm(list=ls())  # Careful! This clears all of R's memory!
#-------------------------------------------------------------------------------
# Load The data
myData = read.csv("TherapeuticTouchData.csv")
# N.B.: The functions below expect the data to be a data frame,
# with one component named y being a vector of integer 0,1 values,
# and one component named s being a factor of subject identifiers.
#-------------------------------------------------------------------------------
# Load The data
myData = read.csv("TherapeuticTouchData.csv")
# N.B.: The functions below expect the data to be a data frame,
# with one component named y being a vector of integer 0,1 values,
# and one component named s being a factor of subject identifiers.
#-------------------------------------------------------------------------------
# Load the relevant model into R's working memory:
source("Jags-Ydich-XnomSsubj-MbinomBetaOmegaKappa.R")
#-------------------------------------------------------------------------------
# Optional: Specify filename root and graphical format for saving output.
# Otherwise specify as NULL or leave saveName and saveType arguments
# out of function calls.
fileNameRoot = "Jags-Ydich-XnomSsubj-MbinomBetaOmegaKappa-"
graphFileType = "eps"
#-------------------------------------------------------------------------------
# Generate the MCMC chain:
startTime = proc.time()
mcmcCoda = genMCMC( data=myData , sName="s" , yName="y" ,
numSavedSteps=20000 , saveName=fileNameRoot ,
thinSteps=10 )
stopTime = proc.time()
show( stopTime-startTime )
#-------------------------------------------------------------------------------
# Display diagnostics of chain, for specified parameters:
parameterNames = varnames(mcmcCoda) # get all parameter names for reference
for ( parName in parameterNames[c(1:3,length(parameterNames))] ) {
diagMCMC( codaObject=mcmcCoda , parName=parName ,
saveName=fileNameRoot , saveType=graphFileType )
}
#-------------------------------------------------------------------------------
# Get summary statistics of chain:
summaryInfo = smryMCMC( mcmcCoda , compVal=0.5 ,
diffIdVec=c(1,14,28), compValDiff=0.0,
saveName=fileNameRoot )
# Display posterior information:
plotMCMC( mcmcCoda , data=myData , sName="s" , yName="y" ,
compVal=0.5 , #rope=c(0.45,0.55) ,
diffIdVec=c(1,14,28), compValDiff=0.0, #ropeDiff = c(-0.05,0.05) ,
saveName=fileNameRoot , saveType=graphFileType )
#-------------------------------------------------------------------------------
# Display posterior information:
plotMCMC( mcmcCoda , data=myData , sName="s" , yName="y" ,
compVal=0.5 , #rope=c(0.45,0.55) ,
diffIdVec=c(1,14,28), compValDiff=0.0, #ropeDiff = c(-0.05,0.05) ,
saveName=fileNameRoot , saveType=graphFileType )
#-------------------------------------------------------------------------------
# Display posterior information:
plotMCMC( mcmcCoda , data=myData , sName="s" , yName="y" ,
compVal=0.5 , #rope=c(0.45,0.55) ,
diffIdVec=c(1,14,28), compValDiff=0.0, #ropeDiff = c(-0.05,0.05) )
#-------------------------------------------------------------------------------
# Display posterior information:
plotMCMC( mcmcCoda , data=myData , sName="s" , yName="y" ,
compVal=0.5 , #rope=c(0.45,0.55) ,
diffIdVec=c(1,14,28), compValDiff=0.0) #ropeDiff = c(-0.05,0.05) )
#-------------------------------------------------------------------------------
plotMCMC( mcmcCoda , data=myData , sName="s" , yName="y" ,
compVal=0.5 , #rope=c(0.45,0.55) ,
diffIdVec=c(1,14,28), compValDiff=0.0, #ropeDiff = c(-0.05,0.05) ,
saveName=fileNameRoot , saveType=graphFileType )
#-------------------------------------------------------------------------------
# Display posterior information:
plotMCMC( mcmcCoda , data=myData , sName="s" , yName="y" ,
compVal=0.5 , #rope=c(0.45,0.55) ,
diffIdVec=c(1,14,28), compValDiff=0.0, #ropeDiff = c(-0.05,0.05) ,
saveName=fileNameRoot , saveType=graphFileType )
#-------------------------------------------------------------------------------
#-------------------------------------------------------------------------------
# Load the relevant model into R's working memory:
source("Jags-Ydich-XnomSsubj-MbinomBetaOmegaKappa_MeanPrior.R")
#-------------------------------------------------------------------------------
# Load the relevant model into R's working memory:
source("Jags-Ydich-XnomSsubj-MbinomBetaOmegaKappa_ModePrior.R")
#-------------------------------------------------------------------------------
# Optional: Specify filename root and graphical format for saving output.
# Otherwise specify as NULL or leave saveName and saveType arguments
# out of function calls.
fileNameRoot = "Jags-Ydich-XnomSsubj-MbinomBetaOmegaKappa-"
graphFileType = "eps"
#-------------------------------------------------------------------------------
# Generate the MCMC chain:
startTime = proc.time()
mcmcCoda = genMCMC( data=myData , sName="s" , yName="y" ,
numSavedSteps=20000 , saveName=fileNameRoot ,
thinSteps=10 )
source("DBDA2E-utilities.R")
gammaShRaFromMeanSD(mean = 1, sd = 10)
gammaShRaFromModeSD(mode = 1, sd = 10)
layout(matrix(1:3,ncol=1))
k=seq(0,200,length=10001)
plot( k, dgamma(k,1.105125,0.105125), ylab="dgamma(k)",
type="l", main="Gamma Distrib's (SD=10)" )
lines( k, dgamma(k,0.01,0.01), col="skyblue" )
legend( "topright", c("Mode 1","Mean 1"),
lty=c(1,1), col=c("black","skyblue"), text.col=c("black", "skyblue") )
plot( k, dgamma(k,1.105125,0.105125), ylab="dgamma(k)",
type="l", ylim=c(.07,.08), main="Gamma Distrib's (SD=10), zoomed in" )
lines( k, dgamma(k,0.01,0.01), col="skyblue" )
legend( "topright", c("Mode 1","Mean 1"),
lty=c(1,1), col=c("black","skyblue"), text.col=c("black", "skyblue") )
plot( k, dgamma(k,1.105125,0.105125), ylab="dgamma(k)",
type="l", ylim=c(0,8.0e-5), main="Gamma Distrib's (SD=10), zoomed in" )
lines( k, dgamma(k,0.01,0.01), col="skyblue" )
legend( "topright", c("Mode 1","Mean 1"),
lty=c(1,1), col=c("black","skyblue"), text.col=c("black", "skyblue") )
# Example for Jags-Ydich-XnomSsubj-MbinomBetaOmegaKappa.R
#-------------------------------------------------------------------------------
# Optional generic preliminaries:
#graphics.off() # This closes all of R's graphics windows.
rm(list=ls())  # Careful! This clears all of R's memory!
#-------------------------------------------------------------------------------
# Load The data
myData = read.csv("TherapeuticTouchData.csv")
# N.B.: The functions below expect the data to be a data frame,
# with one component named y being a vector of integer 0,1 values,
# and one component named s being a factor of subject identifiers.
#-------------------------------------------------------------------------------
# Load The data
myData = read.csv("TherapeuticTouchData.csv")
# N.B.: The functions below expect the data to be a data frame,
# with one component named y being a vector of integer 0,1 values,
# and one component named s being a factor of subject identifiers.
#-------------------------------------------------------------------------------
# Load the relevant model into R's working memory:
source("Jags-Ydich-XnomSsubj-MbinomBetaOmegaKappa_MeanPrior.R")
#-------------------------------------------------------------------------------
# Optional: Specify filename root and graphical format for saving output.
# Otherwise specify as NULL or leave saveName and saveType arguments
# out of function calls.
fileNameRoot = "Jags-Ydich-XnomSsubj-MbinomBetaOmegaKappa-"
graphFileType = "eps"
#-------------------------------------------------------------------------------
# Generate the MCMC chain:
startTime = proc.time()
mcmcCoda = genMCMC( data=myData , sName="s" , yName="y" ,
numSavedSteps=20000 , saveName=fileNameRoot ,
thinSteps=10 )
stopTime = proc.time()
show( stopTime-startTime )
#-------------------------------------------------------------------------------
# Display diagnostics of chain, for specified parameters:
parameterNames = varnames(mcmcCoda) # get all parameter names for reference
for ( parName in parameterNames[c(1:3,length(parameterNames))] ) {
diagMCMC( codaObject=mcmcCoda , parName=parName ,
saveName=fileNameRoot , saveType=graphFileType )
}
#-------------------------------------------------------------------------------
# Get summary statistics of chain:
summaryInfo = smryMCMC( mcmcCoda , compVal=0.5 ,
diffIdVec=c(1,14,28), compValDiff=0.0,
saveName=fileNameRoot )
#-------------------------------------------------------------------------------
# Load the relevant model into R's working memory:
source("Jags-Ydich-XnomSsubj-MbinomBetaOmegaKappa_ModePrior.R")
#-------------------------------------------------------------------------------
# Optional: Specify filename root and graphical format for saving output.
# Otherwise specify as NULL or leave saveName and saveType arguments
# out of function calls.
fileNameRoot = "Jags-Ydich-XnomSsubj-MbinomBetaOmegaKappa-"
graphFileType = "eps"
#-------------------------------------------------------------------------------
# Generate the MCMC chain:
startTime = proc.time()
mcmcCoda = genMCMC( data=myData , sName="s" , yName="y" ,
numSavedSteps=20000 , saveName=fileNameRoot ,
thinSteps=10 )
stopTime = proc.time()
show( stopTime-startTime )
#-------------------------------------------------------------------------------
# Display diagnostics of chain, for specified parameters:
parameterNames = varnames(mcmcCoda) # get all parameter names for reference
for ( parName in parameterNames[c(1:3,length(parameterNames))] ) {
diagMCMC( codaObject=mcmcCoda , parName=parName ,
saveName=fileNameRoot , saveType=graphFileType )
}
#-------------------------------------------------------------------------------
# Get summary statistics of chain:
summaryInfo = smryMCMC( mcmcCoda , compVal=0.5 ,
diffIdVec=c(1,14,28), compValDiff=0.0,
saveName=fileNameRoot )
source("Jags-Ydich-XnomSsubj-MbinomBetaOmegaKappa.R")
# Generate the MCMC chain:
startTime = proc.time()
mcmcCoda = genMCMC( data=myData , sName="s" , yName="y" ,
numSavedSteps=20000 , saveName=fileNameRoot ,
thinSteps=10 )
stopTime = proc.time()
show( stopTime-startTime )
# Display diagnostics of chain, for specified parameters:
parameterNames = varnames(mcmcCoda) # get all parameter names for reference
for ( parName in parameterNames[c(1:3,length(parameterNames))] ) {
diagMCMC( codaObject=mcmcCoda , parName=parName ,
saveName=fileNameRoot , saveType=graphFileType )
}
# Generate the MCMC chain:
startTime = proc.time()
mcmcCoda = genMCMC( data=myData , sName="s" , yName="y" ,
numSavedSteps=20000 , saveName=fileNameRoot ,
thinSteps=10 )
stopTime = proc.time()
show( stopTime-startTime )
#-------------------------------------------------------------------------------
# Display diagnostics of chain, for specified parameters:
parameterNames = varnames(mcmcCoda) # get all parameter names for reference
for ( parName in parameterNames[c(1:3,length(parameterNames))] ) {
diagMCMC( codaObject=mcmcCoda , parName=parName ,
saveName=fileNameRoot , saveType=graphFileType )
}
#-------------------------------------------------------------------------------
# Display diagnostics of chain, for specified parameters:
parameterNames = varnames(mcmcCoda) # get all parameter names for reference
for ( parName in parameterNames[c(1:4,length(parameterNames))] ) {
diagMCMC( codaObject=mcmcCoda , parName=parName ,
saveName=fileNameRoot , saveType=graphFileType )
}
#-------------------------------------------------------------------------------
# Load the relevant model into R's working memory:
source("Jags-Ydich-XnomSsubj-MbinomBetaOmegaKappa_MeanPrior.R")
#-------------------------------------------------------------------------------
# Optional: Specify filename root and graphical format for saving output.
# Otherwise specify as NULL or leave saveName and saveType arguments
# out of function calls.
fileNameRoot = "Jags-Ydich-XnomSsubj-MbinomBetaOmegaKappa-"
graphFileType = "eps"
#-------------------------------------------------------------------------------
# Generate the MCMC chain:
startTime = proc.time()
mcmcCoda = genMCMC( data=myData , sName="s" , yName="y" ,
numSavedSteps=20000 , saveName=fileNameRoot ,
thinSteps=10 )
stopTime = proc.time()
show( stopTime-startTime )
#-------------------------------------------------------------------------------
# Display diagnostics of chain, for specified parameters:
parameterNames = varnames(mcmcCoda) # get all parameter names for reference
for ( parName in parameterNames[c(1:3,length(parameterNames))] ) {
diagMCMC( codaObject=mcmcCoda , parName=parName ,
saveName=fileNameRoot , saveType=graphFileType )
}
#-------------------------------------------------------------------------------
# Load the relevant model into R's working memory:
source("Jags-Ydich-XnomSsubj-MbinomBetaOmegaKappa.R")
# Generate the MCMC chain:
startTime = proc.time()
mcmcCoda = genMCMC( data=myData , sName="s" , yName="y" ,
numSavedSteps=20000 , saveName=fileNameRoot ,
thinSteps=10 )
# Generate the MCMC chain:
startTime = proc.time()
mcmcCoda = genMCMC( data=myData , sName="s" , yName="y" ,
numSavedSteps=20000 , saveName=fileNameRoot ,
thinSteps=10 )
# Generate the MCMC chain:
startTime = proc.time()
mcmcCoda = genMCMC( data=myData , sName="s" , yName="y" ,
numSavedSteps=20000 , saveName=fileNameRoot ,
thinSteps=10 )
#-------------------------------------------------------------------------------
# Load the relevant model into R's working memory:
source("Jags-Ydich-XnomSsubj-MbinomBetaOmegaKappa.R")
# Generate the MCMC chain:
startTime = proc.time()
mcmcCoda = genMCMC( data=myData , sName="s" , yName="y" ,
numSavedSteps=20000 , saveName=fileNameRoot ,
thinSteps=10 )
stopTime = proc.time()
show( stopTime-startTime )
#-------------------------------------------------------------------------------
# Load the relevant model into R's working memory:
source("Jags-Ydich-XnomSsubj-MbinomBetaOmegaKappa_rjags.R")
# Generate the MCMC chain:
startTime = proc.time()
mcmcCoda = genMCMC( data=myData , sName="s" , yName="y" ,
numSavedSteps=20000 , saveName=fileNameRoot ,
thinSteps=10 )
#-------------------------------------------------------------------------------
# Load the relevant model into R's working memory:
source("Jags-Ydich-XnomSsubj-MbinomBetaOmegaKappa_rjags.R")
# Generate the MCMC chain:
startTime = proc.time()
mcmcCoda = genMCMC( data=myData , sName="s" , yName="y" ,
numSavedSteps=20000 , saveName=fileNameRoot ,
thinSteps=10 )
stopTime = proc.time()
show( stopTime-startTime )
