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 |
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.
(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.
Philipp Hermann, [email protected]
Jozef Kiselak, [email protected]
Milan Stehlik, [email protected]
Maintainer: Philipp Hermann <[email protected]>
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.
## 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)
## 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)
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.
calcRamification(figure)
calcRamification(figure)
figure |
Data matrix for which ramification is calculated |
Returns ramification of Data
Shall not be called or changed by user.
Philipp Hermann; Jozef Kiselak; Milan Stehlik\ [email protected]; [email protected]; [email protected]
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.
r = calcRamification(nrow(Data0201))
r = calcRamification(nrow(Data0201))
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.
createSmallerMatrix(givenMatrix)
createSmallerMatrix(givenMatrix)
givenMatrix |
Data for which smaller Matrix should be computed |
Matrix with size of three to the power of ramification of data - 1. This matrix is filled on every position with 99.
Shall not be called or changed by user.
Philipp Hermann; Jozef Kiselak; Milan Stehlik\ [email protected]; [email protected]; [email protected]
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.
matrix.s = createSmallerMatrix(Data0201)
matrix.s = createSmallerMatrix(Data0201)
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.
data(Data0201)
data(Data0201)
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.
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.
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.
data(Data0201)
data(Data0201)
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.
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.
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.
data(Data0501)
data(Data0501)
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.
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.
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.
data(Data0603)
data(Data0603)
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.
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.
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.
estimationFunction(daten, decs)
estimationFunction(daten, decs)
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. |
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 |
Philipp Hermann; Jozef Kiselak; Milan Stehlik\ [email protected]; [email protected]; [email protected]
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.
## 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)
## 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)
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.
fillMatrix(totalMatrix, smallerMatrix)
fillMatrix(totalMatrix, smallerMatrix)
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. |
Returns filled "smaller" matrix, from which parameter p will be estimated.
Shall not be called or changed by user.
Philipp Hermann; Jozef Kiselak; Milan Stehlik\ [email protected]; [email protected]; [email protected]
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.
matrix.sma = createSmallerMatrix(Data0501) matrix.tot = Data0501 matrix.res = fillMatrix(matrix.tot, matrix.sma)
matrix.sma = createSmallerMatrix(Data0501) matrix.tot = Data0501 matrix.res = fillMatrix(matrix.tot, matrix.sma)
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.
GSC(p,N,sierp=TRUE)
GSC(p,N,sierp=TRUE)
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 |
This function creates a matrix of size 3^N x 3^N
containing simulated zeros and ones from Bernoulli distribution under given probability p
.
Philipp Hermann; Jozef Kiselak; Milan Stehlik\ [email protected]; [email protected]; [email protected]
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.
GSC(p = 0.2, N = 4, sierp = TRUE) GSC(p = 0.8, N = 2, sierp = FALSE)
GSC(p = 0.2, N = 4, sierp = TRUE) GSC(p = 0.8, N = 2, sierp = FALSE)
This function simulates random Sierpinski-Carpets using different probabilities per ramification for the computation of the Bernoulli random variables placed in the matrix.
GSC_seq(p, sierp=TRUE)
GSC_seq(p, sierp=TRUE)
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 |
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
.
Philipp Hermann; Jozef Kiselak; Milan Stehlik\ [email protected]; [email protected]; [email protected]
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.
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.
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.
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.
increment(counter)
increment(counter)
counter |
Temporary functional variable |
Incremented value is returned
Shall not be called or changed by user.
Philipp Hermann; Jozef Kiselak; Milan Stehlik\ [email protected]; [email protected]; [email protected]
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.
temp = 0 temp = increment(temp)
temp = 0 temp = increment(temp)
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.
potence(a, b)
potence(a, b)
a |
Basis |
b |
Exponent |
Exponentiated value (a to the power of b) is returned
Shall not be called or changed by user.
Philipp Hermann; Jozef Kiselak; Milan Stehlik\ [email protected]; [email protected]; [email protected]
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.
res = potence(2,4) res2 = potence(3,3) res3 = potence(3,4)
res = potence(2,4) res2 = potence(3,3) res3 = potence(3,4)
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.
simMatrix(p, sierp)
simMatrix(p, sierp)
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 |
The function creates a 3x3 matrix containing simulated zeros and ones from Bernoulli distribution under given probability p
.
Shall not be called or changed by user.
Philipp Hermann; Jozef Kiselak; Milan Stehlik\ [email protected]; [email protected]; [email protected]
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.
simMatrix(p = 0.3, sierp = TRUE) simMatrix(p = 0.8, sierp = FALSE)
simMatrix(p = 0.3, sierp = TRUE) simMatrix(p = 0.8, sierp = FALSE)