Skip to content

Commit

Permalink
typos correction
Browse files Browse the repository at this point in the history
  • Loading branch information
LukaszChrostowski committed Jan 20, 2025
1 parent 36affe0 commit f3ae5c1
Show file tree
Hide file tree
Showing 12 changed files with 36 additions and 36 deletions.
14 changes: 7 additions & 7 deletions NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,13 @@
- bug Fix related to storing `vector` in `model_frame` when predicting `y_hat` in mass imputation `glm` model when X is based in one auxiliary variable only - fix provided converting it to `data.frame` object.

### Features
- add information to `summary` about quality of estimation basing on difference between estimated and known total values of auxiliary variables
- add estimation of exact standard error for k-nearest neighbor estimator.
- add breaking change to `controlOut` function by switching values for `predictive_match` argument. From now on, the `predictive_match = 1` means $\hat{y}-\hat{y}$ in predictive mean matching imputation and `predictive_match = 2` corresponds to $\hat{y}-y$ matching.
- implement `div` option when variable selection (more in documentation) for doubly robust estimation.
- add more insights to `nonprob` output such as gradient, hessian and jacobian derived from IPW estimation for `mle` and `gee` methods when `IPW` or `DR` model executed.
- add estimated inclusion probabilities and its derivatives for probability and non-probability samples to `nonprob` output when `IPW` or `DR` model executed.
- add `model_frame` matrix data from probability sample used for mass imputation to `nonprob` when `MI` or `DR` model executed.
- added information to `summary` about quality of estimation basing on difference between estimated and known total values of auxiliary variables
- added estimation of exact standard error for k-nearest neighbor estimator.
- added breaking change to `controlOut` function by switching values for `predictive_match` argument. From now on, the `predictive_match = 1` means $\hat{y}-\hat{y}$ in predictive mean matching imputation and `predictive_match = 2` corresponds to $\hat{y}-y$ matching.
- implemented `div` option when variable selection (more in documentation) for doubly robust estimation.
- added more insights to `nonprob` output such as gradient, hessian and jacobian derived from IPW estimation for `mle` and `gee` methods when `IPW` or `DR` model executed.
- added estimated inclusion probabilities and its derivatives for probability and non-probability samples to `nonprob` output when `IPW` or `DR` model executed.
- added `model_frame` matrix data from probability sample used for mass imputation to `nonprob` when `MI` or `DR` model executed.

### Unit tests
- added unit tests for variable selection models and mi estimation with vector of population totals available
Expand Down
4 changes: 2 additions & 2 deletions R/bias_correction_ipw.R
Original file line number Diff line number Diff line change
Expand Up @@ -57,10 +57,10 @@ mm <- function(X,
"2" = warning("Relatively convergent algorithm when fitting selection model by nleqslv, but user must check if function values are acceptably small."),
"3" = warning("Algorithm did not find suitable point - has stalled cannot find an acceptable new point when fitting selection model by nleqslv."),
"4" = warning("Iteration limit exceeded when fitting selection model by nleqslv."),
"5" = warning("ill-conditioned Jacobian when fitting selection model by nleqslv."),
"5" = warning("Ill-conditioned Jacobian when fitting selection model by nleqslv."),
"6" = warning("Jacobian is singular when fitting selection model by nleqslv."),
"7" = warning("Jacobian is unusable when fitting selection model by nleqslv."),
"-10" = warning("user specified Jacobian is incorrect when fitting selection model by nleqslv.")
"-10" = warning("User specified Jacobian is incorrect when fitting selection model by nleqslv.")
)
}

Expand Down
6 changes: 3 additions & 3 deletions R/cloglogModel.R
Original file line number Diff line number Diff line change
Expand Up @@ -154,9 +154,9 @@ cloglog_model_nonprobsvy <- function(...) {
if (maxLik_an$convergence %in% c(1, 10, 51, 52)) {
switch(as.character(maxLik_an$convergence),
"1" = warning("Warning in fitting selection model with optim: the iteration limit maxit had been reached."),
"10" = warning("degeneracy of the Nelder Mead simplex in fitting selection model by optim."), # TODO -
"51" = warning("warning from the L BFGS B when fitting by optim."), # TODO -
"52" = stop("indicates an error from the L-BFGS-B method when fitting by optim.")
"10" = warning("Degeneracy of the Nelder Mead simplex in fitting selection model by optim."), # TODO -
"51" = warning("Warning from the L BFGS B when fitting by optim."), # TODO -
"52" = stop("Indicates an error from the L-BFGS-B method when fitting by optim.")
)
}
theta <- maxLik_an$par
Expand Down
2 changes: 1 addition & 1 deletion R/control_selection.R
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
#' \frac{\pi(\mathbf{x}, \boldsymbol{\theta})}{\mathbf{x}}}
#' \item if \code{2} then \mjseqn{ \mathbf{h}\left(\mathbf{x}, \boldsymbol{\theta}\right) = \mathbf{x}}
#' }
#' @param penalty The penanlization function used during variables selection.
#' @param penalty The penalization function used during variables selection.
#' @param a_SCAD The tuning parameter of the SCAD penalty for selection model. Default is 3.7.
#' @param a_MCP The tuning parameter of the MCP penalty for selection model. Default is 3.
#' @param lambda A user-specified \mjseqn{\lambda} value during variable selection model fitting.
Expand Down
2 changes: 1 addition & 1 deletion R/data.R
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#' Job Vacancy Survey
#'
#' @description
#' This is a subset of the subset of the Job Vacancy Survey from Poland (for one quarter).
#' This is a subset of the Job Vacancy Survey from Poland (for one quarter).
#' The data has been subject to slight manipulation, but the relationships in the data have been preserved.
#' For further details on the JVS, please refer to the following link:
#' \url{https://stat.gov.pl/obszary-tematyczne/rynek-pracy/popyt-na-prace/zeszyt-metodologiczny-popyt-na-prace,3,1.html}.
Expand Down
4 changes: 2 additions & 2 deletions R/logitModel.R
Original file line number Diff line number Diff line change
Expand Up @@ -134,8 +134,8 @@ logit_model_nonprobsvy <- function(...) {
switch(as.character(maxLik_an$convergence),
"1" = warning("Warning in fitting selection model with optim: the iteration limit maxit had been reached."),
"10" = warning("degeneracy of the Nelder Mead simplex in fitting selection model by optim."), # TODO -
"51" = warning("warning from the L BFGS B when fitting by optim."), # TODO -
"52" = stop("indicates an error from the L BFGS B method when fitting by optim.")
"51" = warning("Warning from the L BFGS B when fitting by optim."), # TODO -
"52" = stop("Indicates an error from the L BFGS B method when fitting by optim.")
)
}

Expand Down
2 changes: 1 addition & 1 deletion R/main_function_documentation.R
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ NULL
#' Using the imputed values for the probability sample and the (known) design weights,
#' we can build a population mean estimator of the form:
#' \mjsdeqn{\hat{\mu}_{MI} = \frac{1}{N^B}\sum_{i \in S_{B}} d_{i}^{B} \hat{y}_i.}
#' It opens the the door to a very flexible method for imputation models. The package uses generalized linear models from [stats::glm()],
#' It opens the door to a very flexible method for imputation models. The package uses generalized linear models from [stats::glm()],
#' the nearest neighbour algorithm using [RANN::nn2()] and predictive mean matching.
#'
#' 3. Doubly robust estimation -- The IPW and MI estimators are sensitive to misspecified models for the propensity score and outcome variable, respectively.
Expand Down
2 changes: 1 addition & 1 deletion R/nonprob.R
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ nonprob <- function(data,
if (!(family_outcome %in% c("gaussian", "binomial", "poisson"))) stop("Invalid family for outcome formula.")
if (!is.null(control_selection$key)) {
if (!(control_selection$key %in% colnames(data)) || !(control_selection$key %in% colnames(svydesign$variables))) {
stop("key variable for overlapping units must be defined with this same name in prob and nonprob sample.")
stop("Key variable for overlapping units must be defined with this same name in prob and nonprob sample.")
}
}

Expand Down
10 changes: 5 additions & 5 deletions R/probitModel.R
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ probit_model_nonprobsvy <- function(...) {

if (maxLik_an$code %in% c(3:7, 100)) {
switch(as.character(maxLik_an$code),
"3" = warning("warning in fitting selection model with maxLik: probably not converged."),
"3" = warning("Warning in fitting selection model with maxLik: probably not converged."),
"4" = warning("Maxiteration limit reached in fitting selection model by maxLik."),
"5" = stop("Inifinite value of log_like in fitting selection model by maxLik, error code 5"),
"6" = stop("Inifinite value of gradient in fitting selection model by maxLik, error code 6"),
Expand Down Expand Up @@ -144,10 +144,10 @@ probit_model_nonprobsvy <- function(...) {
)
if (maxLik_an$convergence %in% c(1, 10, 51, 52)) {
switch(as.character(maxLik_an$convergence),
"1" = warning("warning in fitting selection model with optim: the iteration limit maxit had been reached."),
"10" = warning("degeneracy of the Nelder Mead simplex in fitting selection model by optim."), # TODO -
"51" = warning("warning from the L BFGS B when fitting by optim."), # TODO -
"52" = stop("indicates an error from the L-BFGS-B method when fitting by optim.")
"1" = warning("Warning in fitting selection model with optim: the iteration limit maxit had been reached."),
"10" = warning("Degeneracy of the Nelder Mead simplex in fitting selection model by optim."), # TODO -
"51" = warning("Warning from the L BFGS B when fitting by optim."), # TODO -
"52" = stop("Indicates an error from the L-BFGS-B method when fitting by optim.")
)
}

Expand Down
4 changes: 2 additions & 2 deletions R/theta_funcs.R
Original file line number Diff line number Diff line change
Expand Up @@ -138,10 +138,10 @@ theta_h_estimation <- function(R,
"2" = warning("Relatively convergent algorithm when fitting selection model by nleqslv, but user must check if function values are acceptably small."),
"3" = warning("Algorithm did not find suitable point - has stalled cannot find an acceptable new point when fitting selection model by nleqslv."),
"4" = warning("Iteration limit exceeded when fitting selection model by nleqslv."),
"5" = warning("ill-conditioned Jacobian when fitting selection model by nleqslv."),
"5" = warning("Ill-conditioned Jacobian when fitting selection model by nleqslv."),
"6" = warning("Jacobian is singular when fitting selection model by nleqslv."),
"7" = warning("Jacobian is unusable when fitting selection model by nleqslv."),
"-10" = warning("user specified Jacobian is incorrect when fitting selection model by nleqslv.")
"-10" = warning("User specified Jacobian is incorrect when fitting selection model by nleqslv.")
)
}
theta_h <- as.vector(theta_root)
Expand Down
8 changes: 4 additions & 4 deletions README.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ population or probability sample is available:

- inverse probability weighting estimators with possible calibration
constraints [@chen2020],
- mass imputation estimators based in nearest neighbours [@yang2021],
- mass imputation estimators based on nearest neighbours [@yang2021],
predictive mean matching and regression imputation [@kim2021],
- doubly robust estimators with bias minimization [@chen2020,
@yang2020].
Expand All @@ -61,12 +61,12 @@ The package allows for:
- different links for selection (`logit`, `probit` and `cloglog`) and
outcome (`gaussian`, `binomial` and `poisson`) variables.

Details on use of the package be found:
Details on the use of the package can be found:

- on the draft (and not proofread) version the book [Modern inference
- in the draft (and not proofread) version of the book [Modern inference
methods for non-probability samples with
R](https://ncn-foreigners.github.io/nonprobsvy-book/),
- example codes that reproduce papers are available at github in the
- in example codes that reproduce papers available on github in the
repository [software
tutorials](https://github.com/ncn-foreigners/software-tutorials).

Expand Down
14 changes: 7 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ population or probability sample is available:

- inverse probability weighting estimators with possible calibration
constraints ([Chen, Li, and Wu 2020](#ref-chen2020)),
- mass imputation estimators based in nearest neighbours ([Yang, Kim,
- mass imputation estimators based on nearest neighbours ([Yang, Kim,
and Hwang 2021](#ref-yang2021)), predictive mean matching and
regression imputation ([Kim et al. 2021](#ref-kim2021)),
- doubly robust estimators with bias minimization Yang, Kim, and Song
Expand All @@ -46,12 +46,12 @@ The package allows for:
- different links for selection (`logit`, `probit` and `cloglog`) and
outcome (`gaussian`, `binomial` and `poisson`) variables.

Details on use of the package be found:
Details on the use of the package can be found:

- on the draft (and not proofread) version the book [Modern inference
- in the draft (and not proofread) version of the book [Modern inference
methods for non-probability samples with
R](https://ncn-foreigners.github.io/nonprobsvy-book/),
- example codes that reproduce papers are available at github in the
- in example codes that reproduce papers available on github in the
repository [software
tutorials](https://github.com/ncn-foreigners/software-tutorials).

Expand Down Expand Up @@ -579,13 +579,13 @@ summary(result_ipw)
#> target = ~y1, svydesign = sample_prob)
#>
#> -------------------------
#> Estimated population mean: 2.925 with overall std.err of: 0.05
#> Estimated population mean: 2.925 with overall std.err of: 0.04999
#> And std.err for nonprobability and probability samples being respectively:
#> 0.001586 and 0.04997
#> 0.001325 and 0.04997
#>
#> 95% Confidence inverval for popualtion mean:
#> lower_bound upper_bound
#> y1 2.82679 3.022776
#> y1 2.826805 3.022761
#>
#>
#> Based on: Inverse probability weighted method
Expand Down

0 comments on commit f3ae5c1

Please sign in to comment.