| Type: | Package | 
| Title: | Fitting of Parametric Models using Summary Statistics | 
| Version: | 1.2 | 
| Date: | 2022-06-06 | 
| Author: | Christiana Kartsonaki | 
| Maintainer: | Christiana Kartsonaki <christiana.kartsonaki@gmail.com> | 
| Description: | Fits complex parametric models using the method proposed by Cox and Kartsonaki (2012) without likelihoods. | 
| Imports: | survey | 
| License: | GPL-2 | GPL-3 [expanded from: GPL (≥ 2)] | 
| Packaged: | 2022-06-06 22:50:01 UTC; christianak | 
| NeedsCompilation: | no | 
| Repository: | CRAN | 
| Date/Publication: | 2022-06-06 23:10:05 UTC | 
Fitting of Parametric Models using Summary Statistics
Description
Fits complex parametric models without likelihoods, using the method proposed by Cox and Kartsonaki (2012).
Details
| Package: | ssfit | 
| Type: | Package | 
| Version: | 1.2 | 
| Date: | 2022-06-06 | 
| Depends: survey License: | GPL (>= 2) | 
See fit.model.
Author(s)
Christiana Kartsonaki
Maintainer: Christiana Kartsonaki <christiana.kartsonaki@gmail.com>
References
Cox, D. R. and Kartsonaki, C. (2012). The fitting of complex parametric models. Biometrika, 99 (3): 741–747.
Fitting of parametric models using summary statistics
Description
Fits complex parametric models with intractable likelihood using the method proposed by Cox and Kartsonaki (2012).
Usage
fit.model(p, q, n, r, starting_values, h_vector, data_true, sim_data, features, n_iter,
print_results = TRUE, variances = TRUE)
Arguments
p | 
 Number of parameters to be estimated.  | 
q | 
 Number of features / summary statistics.  | 
n | 
 Sample size. Usually equal to the number of observations in the data (  | 
r | 
 Number of simulations to be run at each design point, in each iteration.  | 
starting_values | 
 A vector of starting values for the parameter vector.  | 
h_vector | 
 A vector of spacings   | 
data_true | 
 The dataset.  | 
sim_data | 
 A function which simulates data using the model to be fitted.  | 
features | 
 A function which calculates the features / summary statistics.  | 
n_iter | 
 Number of iterations of the algorithm to be performed.  | 
print_results | 
 If   | 
variances | 
 If   | 
Details
Function sim_data should simulate from the model, taking as arguments the sample size and the parameter vector.
Function features must take as an argument the simulated data generated by sim_data and calculate the features / summary statistics. The format of the dataset and the simulated data should be the same and should match the format needed by the function features. Function features must return a vector of length q.
Value
estimates | 
 The estimates of the parameters.  | 
var_estimates | 
 The covariance matrix of the final estimates.  | 
L | 
 The matrix of coefficients L.  | 
sigma | 
 The covariance matrix of the features.  | 
zbar | 
 The average values of the simulated features at each design point.  | 
z_D | 
 The values of the features calculated from the data.  | 
ybar | 
 The linear combinations of the simulated features at each design point.  | 
y_D | 
 The linear combinations of the features calculated from the data.  | 
Author(s)
Christiana Kartsonaki
References
Cox, D. R. and Kartsonaki, C. (2012). The fitting of complex parametric models. Biometrika, 99 (3): 741–747.
Examples
# estimate the mean of a N(2, 1) distribution
sim_function <- function(n, mu) {
	rnorm(n, unlist(mu), 1)
	}
features_function <- function(data) {
	a <- median(data)
	b <- sum(data) - (min(data) + max(data))
	c <- (min(data) + max(data)) / 2
	return(c(a, b, c))
	}
	
fit1 <- fit.model(p = 1, q = 3, n = 100, r = 100, starting_values = 5, h_vector = 0.1,
data_true = rnorm(100, 2, 1), sim_data = sim_function, features = features_function, 
n_iter = 50, print_results = TRUE, variances = TRUE)