Learn R Programming

BoneProfileR (version 4.0)

BP_FitBayesianPeriodicCompactness: Estimation of the likelihood of a bone section

Description

Estimation of the compactness of a bone section using Bayesian periodic model.
To control the parallel computing, use:
options(mc.cores = [put here the number of cores you want use])
options(forking = FALSE) or options(forking = TRUE)
The maximum number of cores is obtained by: parallel::detectCores()

Usage

BP_FitBayesianPeriodicCompactness(
  bone,
  fitted.parameters = NULL,
  priors = NULL,
  fixed.parameters = NULL,
  analysis = 1,
  silent = FALSE,
  replicates.CI = 2000,
  amplitude.max = 0.1,
  control.MHalgoGen = list(n.iter = 10000, n.chains = 1, trace = TRUE, n.adapt = 5000,
    thin = 1, adaptive = TRUE)
)

Value

The -Ln L

Arguments

bone

The bone image to be used

fitted.parameters

Parameters of the model to be fitted

priors

The priors of Bayesian analysis

fixed.parameters

Fixed parameters of the model

analysis

Name or rank of analysis

silent

Should the function displays some information?

replicates.CI

Number of replicates to estimate confidence interval using Hessian

amplitude.max

The maximum allowed amplitude for each parameter

control.MHalgoGen

The control parameters of MHalgoGen()

Author

Marc Girondot marc.girondot@gmail.com

Details

BP_FitBayesianPeriodicCompactness estimates likelihood of global model of a bone section

See Also

Other BoneProfileR: BP_AutoFit(), BP_ChooseBackground(), BP_ChooseCenter(), BP_ChooseForeground(), BP_DetectBackground(), BP_DetectCenters(), BP_DetectForeground(), BP_DuplicateAnalysis(), BP_EstimateCompactness(), BP_FitBayesianCompactness(), BP_FitMLCompactness(), BP_FitMLPeriodicCompactness(), BP_FitMLRadialCompactness(), BP_GetFittedParameters(), BP_ListAnalyses(), BP_LnLCompactness(), BP_OpenImage(), BP_Report(), Erinaceus_europaeus, plot.BoneProfileR(), summary.BoneProfileR()

Examples

Run this code
if (FALSE) {
# Not run
library(BoneProfileR)
path_Hedgehog <- system.file("extdata", "Erinaceus_europaeus_fem_2-1_small.png", 
                             package = "BoneProfileR")
 bone <- BP_OpenImage(file=path_Hedgehog)
 bone <- BP_DetectBackground(bone=bone, analysis="logistic")
 bone <- BP_DetectForeground(bone=bone, analysis="logistic")
 bone <- BP_DetectCenters(bone=bone, analysis="logistic")
 bone <- BP_EstimateCompactness(bone, analysis="logistic", cut.angle = 60)
 bone <- BP_FitMLCompactness(bone, analysis="logistic", twosteps=TRUE)
 plot(bone, type="observations+model", analysis="logistic")
 par <- BP_GetFittedParameters(bone, analysis="logistic", ML=TRUE, return.all=FALSE)[, "mean"]
 options(mc.cores=parallel::detectCores())
 
 #############################################
 # Periodic analysis
 #############################################
 bone <- BP_FitMLPeriodicCompactness(bone, analysis="logistic", control.optim=list(trace=2), 
                                     fitted.parameters=c(par, PSin=0.001, PCos=0.001, 
                                     SSin=0.001, SCos=0.001, MinSin=0.001, MinCos=0.001, 
                                     MaxSin=0.001, MaxCos=0.001), replicates.CI=2000)
 bone <- BP_FitBayesianPeriodicCompactness(bone, analysis="logistic", replicates.CI=2000)
 mcmc <- RM_get(bone, RMname="logistic", valuename="mcmcPeriodic")
 plot(mcmc, parameters="P", what="MarkovChain", ylim=c(0.555, 0.565), main="P parameter")
 
 plot(bone, type="mcmcPeriodic", parameter.name="compactness", col=rainbow(128))
 plot(bone, type="mcmcPeriodic", parameter.name="compactness", 
               col=hcl.colors(12, "YlOrRd", rev = TRUE))
 plot(bone, type="mcmcPeriodic", parameter.name="averagemodel")
 plot(bone, type="mcmcPeriodic", parameter.name="P", 
               rgb(red = 0.7, green = 0.7, blue = 0.7, alpha = 0.2))
 plot(bone, type="mcmcPeriodic", parameter.name="P", ylim=c(0, 1), 
               rgb(red = 0.7, green = 0.7, blue = 0.7, alpha = 0.2))
 
}

Run the code above in your browser using DataLab