Skip to content

Commit

Permalink
Merge pull request #45 from ncn-foreigners/dev
Browse files Browse the repository at this point in the history
Dev
  • Loading branch information
LukaszChrostowski authored Apr 3, 2024
2 parents 8824584 + 7cf7803 commit d68a087
Show file tree
Hide file tree
Showing 9 changed files with 63 additions and 5 deletions.
4 changes: 2 additions & 2 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Package: nonprobsvy
Type: Package
Title: Package for Inference Based on Non-Probability Samples
Title: Inference Based on Non-Probability Samples
Version: 0.1.0
Authors@R:
c(person(given = "Łukasz",
Expand All @@ -16,7 +16,7 @@ Authors@R:
family = "Chlebicki",
role = "ctb",
email = "piochl@st.amu.edu.pl"))
Description: An R package for statistical inference with non-probability samples when auxiliary information from external sources such as probability samples or population totals or means is available. Details can be found in: Wu et al. (2020) <doi:10.1080/01621459.2019.1677241>, Kim et al. (2021) <doi:10.1111/rssa.12696>, Wu et al. (2023) <https://www150.statcan.gc.ca/n1/pub/12-001-x/2022002/article/00002-eng.htm>, Kim et al. (2021) <https://www150.statcan.gc.ca/n1/pub/12-001-x/2021001/article/00004-eng.htm>, Kim et al. (2020) <doi:10.1111/rssb.12354>.
Description: Statistical inference with non-probability samples when auxiliary information from external sources such as probability samples or population totals or means is available. Details can be found in: Wu et al. (2020) <doi:10.1080/01621459.2019.1677241>, Kim et al. (2021) <doi:10.1111/rssa.12696>, Wu et al. (2023) <https://www150.statcan.gc.ca/n1/pub/12-001-x/2022002/article/00002-eng.htm>, Kim et al. (2021) <https://www150.statcan.gc.ca/n1/pub/12-001-x/2021001/article/00004-eng.htm>, Kim et al. (2020) <doi:10.1111/rssb.12354>.
License: MIT + file LICENSE
Encoding: UTF-8
LazyData: true
Expand Down
2 changes: 2 additions & 0 deletions R/cloglogModel.R
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
#' @description \code{cloglog_model_nonprobsvy} returns all the methods/objects/functions required to estimate the model, assuming a cloglog link function.
#' @param ... Additional, optional arguments.
#'
#' @return List with selected methods/objects/functions.
#'
#' @seealso
#'
#' [nonprob()] -- for fitting procedure with non-probability samples.
Expand Down
4 changes: 2 additions & 2 deletions R/pmm.R
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ pmm_nonprobsvy <- function(outcome,
outcome,
data,
span = .2,
control = stats::loess.control(surface = "direct")
control = stats::loess.control(surface = "interpolate", trace.hat = "approximate")
)
mm$data <- data
mm$formula <- outcome
Expand Down Expand Up @@ -216,7 +216,7 @@ pmm_exact <- function(pi_ij,
formula = model_obj$model$glm_object$formula,
data = model_obj$model$glm_object$data[boot_samp, , drop = FALSE],
span = .2,
control = stats::loess.control(surface = "direct")
control = stats::loess.control(surface = "interpolate", trace.hat = "approximate")
)
)
XX <- predict(
Expand Down
1 change: 1 addition & 0 deletions R/simple_methods.R
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ pop.size.nonprobsvy <- function(object,
#' @description Estimate size of population
#' @param object object returned by `nonprobsvy`.
#' @param ... additional parameters
#' @return Vector returning the value of the estimated population size.
#' @export
pop.size <- function(object, ...) {
UseMethod("pop.size")
Expand Down
24 changes: 24 additions & 0 deletions R/summary.R
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,30 @@
#' @param cov Covariance matrix corresponding to regression parameters
#' @param ... Additional optional arguments
#'
#' @return An object of \code{summary_nonprobsvy} class containing:
#' \itemize{
#' \item \code{call} -- A call which created \code{object}.
#' \item \code{pop_total} -- A list containing information about the estimated population mean, its standard error and confidence interval.
#' \item \code{sample_size} -- The size of the samples used in the model.
#' \item \code{population_size} -- The estimated size of the population from which the nonoprobability sample was drawn.
#' \item \code{test} -- Type of statistical test performed.
#' \item \code{control} -- A List of control parameters used in fitting the model.
#' \item \code{model} -- A descriptive name of the model used, e.g., "Doubly-Robust", "Inverse probability weighted", or "Mass Imputation".
#' \item \code{aic} -- Akaike's information criterion.
#' \item \code{bic} -- Bayesian (Schwarz's) information criterion.
#' \item \code{residuals} -- Residuals from the model, providing information on the difference between observed and predicted values.
#' \item \code{likelihood} -- Logarithm of likelihood function evaluated at coefficients.
#' \item \code{df_residual} -- Residual degrees of freedom.
#' \item \code{weights} -- Distribution of estimated weights obtained from the model.
#' \item \code{coef} -- Regression coefficients estimated by the model.
#' \item \code{std_err} -- Standard errors of the regression coefficients.
#' \item \code{w_val} -- Wald statistic values for the significance testing of coefficients.
#' \item \code{p_values} -- P-values corresponding to the Wald statistic values, assessing the significance of coefficients.
#' \item \code{crr} -- The correlation matrix of the model coefficients, if requested.
#' \item \code{confidence_interval_coef} -- Confidence intervals for the model coefficients.
#' \item \code{names} -- Names of the fitted models.
#' }
#'
#'
#' @method summary nonprobsvy
#' @importFrom stats pt
Expand Down
3 changes: 3 additions & 0 deletions man/cloglog_model_nonprobsvy.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions man/pop.size.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

25 changes: 25 additions & 0 deletions man/summary.nonprobsvy.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion src/Makevars
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
## _In general_ we should no longer need to set a standard as any recent R
## installation will do the right thing. Should you need it, uncomment it and
## set the appropriate value, possibly CXX17.
#CXX_STD = CXX11
# CXX_STD = CXX11

PKG_CXXFLAGS = $(SHLIB_OPENMP_CXXFLAGS)
PKG_LIBS = $(SHLIB_OPENMP_CXXFLAGS) $(LAPACK_LIBS) $(BLAS_LIBS) $(FLIBS)

0 comments on commit d68a087

Please sign in to comment.