Package 'FractalParameterEstimation'

Title: Simulation and Parameter Estimation of Randomized Sierpinski Carpets using the p-p-p-q-Model
Description: The parameters p and q are estimated with the aid of a randomized Sierpinski Carpet which is built on a [p-p-p-q]-model. Thereby, for three times a simulation with a p-value and once with a q-value is assumed. Hence, these parameters are estimated and displayed. Moreover, functions for simulating random Sierpinski-Carpets with constant and variable probabilities are included. For more details on the method please see Hermann et al. (2015) <doi:10.1002/sim.6497>.
Authors: Philipp Hermann, Jozef Kiselak, Milan Stehlik
Maintainer: Philipp Hermann <[email protected]>
License: GPL (>= 2)
Version: 1.1.2
Built: 2024-11-16 06:22:37 UTC
Source: CRAN

Help Index


Simulation and Parameter Estimation of Randomized Sierpinski Carpets using the p-p-p-q-Model

Description

For data consisting of zeros and ones the parameters p and q are estimated on basis of randomized Sierpinksi Carpets. This is done with the aid of [p,p,p,q]-models. Main function estimationFunction(daten, decs) is called and delivers the two estimates rounded on four decimal places. The estimates are calculated with respect to one ramification step, i.e. the last step for q and the third step for p. The function "createsmallerMatrix" enables to calculate the "underlying" matrix on basis of the main matrix. Hence, this computed matrix is filled with special algorithm with values zero respectively one according to numbers of the original data. We also provide functions so simulate Sierpinski-Carpets with either constant or changing parameters of the Bernoulli random variables.

Details

(3x3)-matrices are pattern for Sierpinski-Carpets and in every ramification a new (3x3)-matrix is build. After two ramifications one matrix with dimension (9x9) is therefore constructed. The underlying [p-p-p-q]-model therefore suggests data with size of (81x81) where the probability of success for zeros and ones is three times calculated with a fixed p-value and once with a fixed q-value. The package provides an estimation of these parameters. Examples on basis of simulations are provided to show the goodness of the estimates. However, estimations for images of larger sizes can also be performed, restricted to being larger than (9x9) matrices. Hence, parameter estimation is not equal to [p-p-p-q] model, because more than four ramifications would be necessary.

Package: FractalParameterEstimation
Type: Package
Version: 1.1.1
Date: 2017-09-12
License: GPL (>= 2)
Depends: R (>= 2.2.0)
LazyData: true
BugReports: https://github.com/PhHermann/FractalParameterEstimation

Calling the function estimationFunction(daten, decs) delivers estimations for p and q on the basis of [p,p,p,q]-model, which are built on randomized Sierpinski Carpet.

The functions GSC(p,N,sierp=TRUE) and GSC_seq(p, sierp=TRUE) simulate random Sierpinski-Carpets. The first function uses single (constant) probabilities for the simulation and N ramification steps. The latter one is called with a vector of probabilities p with length as the ramification steps.

Author(s)

Philipp Hermann, [email protected]

Jozef Kiselak, [email protected]

Milan Stehlik, [email protected]

Maintainer: Philipp Hermann <[email protected]>

References

Hermann, P., Mrkvicka, T., Mattfeldt, T., Minarova, M., Helisova, K., Nicolis, O., Wartner, F., and Stehlik, M. (2015). Fractal and stochastic Geometry Inference for Breast Cancer: a Case Study with Random Fractal Models and Quermass-Interaction Process. Statistics in Medicine, 34(18), 2636-2661. doi: 10.1002/sim.6497.

Examples

## Example 1: Original p-Value: 0.2; Original q-value: 0.1
estimationFunction(Data0201, decs = 2)

## Example 2: Original p-value: 0.3; Original q-value: 0.25
estimationFunction(Data03025) # testData2

## Example 3: Original p-value: 0.5; Original q-value: 0.1
estimationFunction(Data0501)

## Example 4: Original p-value: 0.6; Original q-value: 0.3
estimationFunction(Data0603)


### Simulate Sierpinski-Carpet under constant probabilities: 
GSC(p = 0.2, N = 4, sierp = TRUE)
GSC(p = 0.8, N = 2, sierp = FALSE)

## Simulate Sierpinski-Carpet under variable probabilities: 
GSC_seq(p = c(0.1,0.2,0.1,0.4), sierp = TRUE)
GSC_seq(p = c(rep(0.1,3),0.05), sierp = FALSE)

Calculation of Ramification

Description

This function computes on the basis of the data the number of ramifications, which is used later for estimation of parameters. In this setting of a [p-p-p-q]-model calculation for ramification delivers value of 4. Function is used by main function "estimationFunction" and shall not be called or changed by user.

Usage

calcRamification(figure)

Arguments

figure

Data matrix for which ramification is calculated

Value

Returns ramification of Data

Note

Shall not be called or changed by user.

Author(s)

Philipp Hermann; Jozef Kiselak; Milan Stehlik\ [email protected]; [email protected]; [email protected]

References

Hermann, P., Mrkvicka, T., Mattfeldt, T., Minarova, M., Helisova, K., Nicolis, O., Wartner, F., and Stehlik, M. (2015). Fractal and stochastic Geometry Inference for Breast Cancer: a Case Study with Random Fractal Models and Quermass-Interaction Process. Statistics in Medicine, 34(18), 2636-2661. doi: 10.1002/sim.6497.

Examples

r = calcRamification(nrow(Data0201))

Creates Smaller Matrix from Data

Description

In this function a smaller matrix is created with dimensions of size which is calculated over ramification. All of the cells are filled with 99, which is edited in a further step by usage of function (fillMatrix). This matrix is desired, because it represents the status of the data one step before its result. Therefore the impact of q in the [p-p-p-q]-model is neglected and the estimation of p can be one on the basis of the smaller matrix. Function is used by main function "estimationFunction" and shall not be called or changed by user.

Usage

createSmallerMatrix(givenMatrix)

Arguments

givenMatrix

Data for which smaller Matrix should be computed

Value

Matrix with size of three to the power of ramification of data - 1. This matrix is filled on every position with 99.

Note

Shall not be called or changed by user.

Author(s)

Philipp Hermann; Jozef Kiselak; Milan Stehlik\ [email protected]; [email protected]; [email protected]

References

Hermann, P., Mrkvicka, T., Mattfeldt, T., Minarova, M., Helisova, K., Nicolis, O., Wartner, F., and Stehlik, M. (2015). Fractal and stochastic Geometry Inference for Breast Cancer: a Case Study with Random Fractal Models and Quermass-Interaction Process. Statistics in Medicine, 34(18), 2636-2661. doi: 10.1002/sim.6497.

Examples

matrix.s = createSmallerMatrix(Data0201)

Data of simulation of random Sierpinski-Carpet with [p,p,p,q]-model and p = 0.2 and q = 0.1

Description

This dataset results of a simulation on the basis of Sierpinski-Carpet with a [p,p,p,q]-model with fixed values of p = 0.2 and q = 0.1. Data was simulated in JAVA and every cell of data is filled with either zeros or ones. It is a simulation example for breast mammography screenings where the result is a black and white picture and values zero and ones stand for black and white.

Usage

data(Data0201)

Format

A data frame with 81 observations on the following 81 variables. These 81 variables result from 3^4, which means fourth ramification of Sierpinski-Carpet.

References

Hermann, P., Mrkvicka, T., Mattfeldt, T., Minarova, M., Helisova, K., Nicolis, O., Wartner, F., and Stehlik, M. (2015). Fractal and stochastic Geometry Inference for Breast Cancer: a Case Study with Random Fractal Models and Quermass-Interaction Process. Statistics in Medicine, 34(18), 2636-2661. doi: 10.1002/sim.6497.


Data of simulation of random Sierpinski-Carpet with [p,p,p,q]-model and p = 0.3 and q = 0.25

Description

This dataset results of a simulation on the basis of Sierpinski-Carpet with a [p,p,p,q]-model with fixed values of p = 0.3 and q = 0.25. Data was simulated in JAVA and every cell of data is filled with either zeros or ones. It is a simulation example for breast mammography screenings where the result is a black and white picture and values zero and ones stand for black and white.

Usage

data(Data0201)

Format

A data frame with 81 observations on the following 81 variables. These 81 variables result from 3^4, which means fourth ramification of Sierpinski-Carpet.

References

Hermann, P., Mrkvicka, T., Mattfeldt, T., Minarova, M., Helisova, K., Nicolis, O., Wartner, F., and Stehlik, M. (2015). Fractal and stochastic Geometry Inference for Breast Cancer: a Case Study with Random Fractal Models and Quermass-Interaction Process. Statistics in Medicine, 34(18), 2636-2661. doi: 10.1002/sim.6497.


Data of simulation of random Sierpinski-Carpet with [p,p,p,q]-model and p = 0.5 and q = 0.1

Description

This dataset results of a simulation on the basis of Sierpinski-Carpet with a [p,p,p,q]-model with fixed values of p = 0.5 and q = 0.1. Data was simulated in JAVA and every cell of data is filled with either zeros or ones. It is a simulation example for breast mammography screenings where the result is a black and white picture and values zero and ones stand for black and white.

Usage

data(Data0501)

Format

A data frame with 81 observations on the following 81 variables. These 81 variables result from 3^4, which means fourth ramification of Sierpinski-Carpet.

References

Hermann, P., Mrkvicka, T., Mattfeldt, T., Minarova, M., Helisova, K., Nicolis, O., Wartner, F., and Stehlik, M. (2015). Fractal and stochastic Geometry Inference for Breast Cancer: a Case Study with Random Fractal Models and Quermass-Interaction Process. Statistics in Medicine, 34(18), 2636-2661. doi: 10.1002/sim.6497.


Data of simulation of random Sierpinski-Carpet with [p,p,p,q]-model and p = 0.6 and q = 0.3

Description

This dataset results of a simulation on the basis of Sierpinski-Carpet with a [p,p,p,q]-model with fixed values of p = 0.6 and q = 0.3. Data was simulated in JAVA and every cell of data is filled with either zeros or ones. It is a simulation example for breast mammography screenings where the result is a black and white picture and values zero and ones stand for black and white.

Usage

data(Data0603)

Format

A data frame with 81 observations on the following 81 variables. These 81 variables result from 3^4, which means fourth ramification of Sierpinski-Carpet.

References

Hermann, P., Mrkvicka, T., Mattfeldt, T., Minarova, M., Helisova, K., Nicolis, O., Wartner, F., and Stehlik, M. (2015). Fractal and stochastic Geometry Inference for Breast Cancer: a Case Study with Random Fractal Models and Quermass-Interaction Process. Statistics in Medicine, 34(18), 2636-2661. doi: 10.1002/sim.6497.


Estimation of p and q for [p,p,p,q]-model

Description

This function combines all used functions (potence, increment, fillMatrix, calcRamification, createSmallerMatrix) of R-Package and estimates the parameters p and q on the basis of a [p,p,p,q]-model. This model is based on randomized Sierpinski-Carpet, where the two parameters can be chosen independently. It returns value for p and q in a list. The estimation procedure only works for data consisting of zeros and ones, which are representing values for white and areas of for instance mammographic screening of breast tissue. Parameters p and q are estimated independently, both on basis of the impact of one ramification step.

Usage

estimationFunction(daten, decs)

Arguments

daten

Data consisting of either 0 or 1 for every cell, where number of rows must equal to number of columns

decs

Number of decimal places to be rounded. Default value is 4.

Value

p-Estimator

Estimator of p for first three iterations of [p,p,p,q]-model on basis of the third step

q-Estimator

Estimator of q for last step in procedure of [p,p,p,q]-model

Author(s)

Philipp Hermann; Jozef Kiselak; Milan Stehlik\ [email protected]; [email protected]; [email protected]

References

Hermann, P., Mrkvicka, T., Mattfeldt, T., Minarova, M., Helisova, K., Nicolis, O., Wartner, F., and Stehlik, M. (2015). Fractal and stochastic Geometry Inference for Breast Cancer: a Case Study with Random Fractal Models and Quermass-Interaction Process. Statistics in Medicine, 34(18), 2636-2661. doi: 10.1002/sim.6497.

Examples

## Example 1: Original p-Value: 0.2; Original q-value: 0.1
estimationFunction(Data0201, decs = 2)

## Example 2: Original p-value: 0.3; Original q-value: 0.25
estimationFunction(Data03025) # testData2

## Example 3: Original p-value: 0.5; Original q-value: 0.1
estimationFunction(Data0501)

## Example 4: Original p-value: 0.6; Original q-value: 0.3
estimationFunction(Data0603)

Fill Matrix with zeros and ones

Description

This function fills previously created smaller Matrix (see function createSmallerMatrix) either with 0 or 1 according to values of the data. If at least one of the values in higher 3x3 matrix is 1, then cell of subjecent matrix is filled with 1, otherwise with 0. On basis of this matrix parameter p will be estimated. Function is used by main function "estimationFunction" and shall not be called or changed by user.

Usage

fillMatrix(totalMatrix, smallerMatrix)

Arguments

totalMatrix

Data, consisting of either 1 or zero, where number of rows equals to number of columns

smallerMatrix

Previously created matrix with size three to the power of ramification-1 of original Data.

Value

Returns filled "smaller" matrix, from which parameter p will be estimated.

Note

Shall not be called or changed by user.

Author(s)

Philipp Hermann; Jozef Kiselak; Milan Stehlik\ [email protected]; [email protected]; [email protected]

References

Hermann, P., Mrkvicka, T., Mattfeldt, T., Minarova, M., Helisova, K., Nicolis, O., Wartner, F., and Stehlik, M. (2015). Fractal and stochastic Geometry Inference for Breast Cancer: a Case Study with Random Fractal Models and Quermass-Interaction Process. Statistics in Medicine, 34(18), 2636-2661. doi: 10.1002/sim.6497.

Examples

matrix.sma = createSmallerMatrix(Data0501)
matrix.tot = Data0501
matrix.res = fillMatrix(matrix.tot, matrix.sma)

Simulation of Random Sierpinski-Carpets

Description

This function simulates random Sierpinski-Carpets using a constant probability for the computation of the Bernoulli random variables placed in the matrix. An additional parameter determines the number of ramifications in this procedure.

Usage

GSC(p,N,sierp=TRUE)

Arguments

p

A numeric value between 0 and 1 indicating the probability of success (0 or 1) for the Bernoulli random variables of the matrix.

N

An integer value indicating the number of ramifications used for simulating the Sierpinski-Carpet.

sierp

An optional logical parameter: if TRUE then the center of the matrix is automatically set to 0 as for the general Sierpinski-Carpet, else also a Bernoulli random variable is simulated.

Value

This function creates a matrix of size 3^N x 3^N containing simulated zeros and ones from Bernoulli distribution under given probability p.

Author(s)

Philipp Hermann; Jozef Kiselak; Milan Stehlik\ [email protected]; [email protected]; [email protected]

References

Hermann, P., Mrkvicka, T., Mattfeldt, T., Minarova, M., Helisova, K., Nicolis, O., Wartner, F., and Stehlik, M. (2015). Fractal and stochastic Geometry Inference for Breast Cancer: a Case Study with Random Fractal Models and Quermass-Interaction Process. Statistics in Medicine, 34(18), 2636-2661. doi: 10.1002/sim.6497.

Examples

GSC(p = 0.2, N = 4, sierp = TRUE)
GSC(p = 0.8, N = 2, sierp = FALSE)

Simulation of Random Sierpinski-Carpets using variable probabilities

Description

This function simulates random Sierpinski-Carpets using different probabilities per ramification for the computation of the Bernoulli random variables placed in the matrix.

Usage

GSC_seq(p, sierp=TRUE)

Arguments

p

A numeric vector of same length as ramifications for the simulated Sierpinski-Carpet. The vector contains values between 0 and 1 indicating the probability of success (0 or 1) for the Bernoulli random variables of the matrix in each ramification step.

sierp

An optional logical parameter: if TRUE then the center of the matrix is automatically set to 0 as for the general Sierpinski-Carpet, else also a Bernoulli random variable is simulated.

Value

This function creates a matrix of size 3^N x 3^N containing simulated zeros and ones from Bernoulli distribution under given probability p. Here, N is the ramification which equals the length of the input vector p.

Author(s)

Philipp Hermann; Jozef Kiselak; Milan Stehlik\ [email protected]; [email protected]; [email protected]

References

Hermann, P., Mrkvicka, T., Mattfeldt, T., Minarova, M., Helisova, K., Nicolis, O., Wartner, F., and Stehlik, M. (2015). Fractal and stochastic Geometry Inference for Breast Cancer: a Case Study with Random Fractal Models and Quermass-Interaction Process. Statistics in Medicine, 34(18), 2636-2661. doi: 10.1002/sim.6497.

Examples

GSC_seq(p = c(0.1,0.2,0.1,0.4), sierp = TRUE)
GSC_seq(p = c(rep(0.1,3),0.05), sierp = FALSE)  
## this example equals th pppq-model for the estimation.

Increment

Description

Adds one to given variable and returns this computed variable. Function is used by main function "estimationFunction" and shall not be called or changed by user.

Usage

increment(counter)

Arguments

counter

Temporary functional variable

Value

Incremented value is returned

Note

Shall not be called or changed by user.

Author(s)

Philipp Hermann; Jozef Kiselak; Milan Stehlik\ [email protected]; [email protected]; [email protected]

References

Hermann, P., Mrkvicka, T., Mattfeldt, T., Minarova, M., Helisova, K., Nicolis, O., Wartner, F., and Stehlik, M. (2015). Fractal and stochastic Geometry Inference for Breast Cancer: a Case Study with Random Fractal Models and Quermass-Interaction Process. Statistics in Medicine, 34(18), 2636-2661. doi: 10.1002/sim.6497.

Examples

temp = 0
temp = increment(temp)

Exponentiation

Description

Calculation of a to the power of b. This function enables to calculate the sizes for the created (smaller) matrix. Function is used by main function "estimationFunction" and shall not be called or changed by user.

Usage

potence(a, b)

Arguments

a

Basis

b

Exponent

Value

Exponentiated value (a to the power of b) is returned

Note

Shall not be called or changed by user.

Author(s)

Philipp Hermann; Jozef Kiselak; Milan Stehlik\ [email protected]; [email protected]; [email protected]

References

Hermann, P., Mrkvicka, T., Mattfeldt, T., Minarova, M., Helisova, K., Nicolis, O., Wartner, F., and Stehlik, M. (2015). Fractal and stochastic Geometry Inference for Breast Cancer: a Case Study with Random Fractal Models and Quermass-Interaction Process. Statistics in Medicine, 34(18), 2636-2661. doi: 10.1002/sim.6497.

Examples

res = potence(2,4)
res2 = potence(3,3)
res3 = potence(3,4)

Simulating 3x3 matrix with binomial random variables

Description

This function simulates a matrix of size 3x3 and fills these with bernoulli random variables under a probability of p. An optional parameter sierp is added in order to set the center of the matrix to 0 as for the general Sierpinski-Carpet.

Usage

simMatrix(p, sierp)

Arguments

p

A numeric value between 0 and 1 indicating the probability of success (0 or 1) for the Bernoulli random variables of the matrix.

sierp

An optional logical parameter: if TRUE then the center of the matrix is automatically set to 0 as for the general Sierpinski-Carpet, else also a Bernoulli random variable is simulated.

Value

The function creates a 3x3 matrix containing simulated zeros and ones from Bernoulli distribution under given probability p.

Note

Shall not be called or changed by user.

Author(s)

Philipp Hermann; Jozef Kiselak; Milan Stehlik\ [email protected]; [email protected]; [email protected]

References

Hermann, P., Mrkvicka, T., Mattfeldt, T., Minarova, M., Helisova, K., Nicolis, O., Wartner, F., and Stehlik, M. (2015). Fractal and stochastic Geometry Inference for Breast Cancer: a Case Study with Random Fractal Models and Quermass-Interaction Process. Statistics in Medicine, 34(18), 2636-2661. doi: 10.1002/sim.6497.

Examples

simMatrix(p = 0.3, sierp = TRUE)
simMatrix(p = 0.8, sierp = FALSE)