diff --git a/DESCRIPTION b/DESCRIPTION index f72b29e..b470fe1 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,11 +1,11 @@ Package: BIFIEsurvey Type: Package Title: Tools for Survey Statistics in Educational Assessment -Version: 3.4-1 -Date: 2019-06-12 17:17:21 +Version: 3.4-3 +Date: 2020-07-24 18:27:54 Author: BIFIE [aut], Alexander Robitzsch [aut, cre], Konrad Oberwimmer [aut] -Maintainer: Alexander Robitzsch +Maintainer: Alexander Robitzsch Description: Contains tools for survey statistics (especially in educational assessment) for datasets with replication designs (jackknife, @@ -42,4 +42,3 @@ URL: https://www.bifie.at/large-scale-assessment-mit-r-methodische-grundlagen-der-oesterreichischen-bildungsstandardueberpruefung, https://github.com/alexanderrobitzsch/BIFIEsurvey, https://sites.google.com/site/alexanderrobitzsch2/software -RoxygenNote: 6.1.1 diff --git a/R/RcppExports.R b/R/RcppExports.R index 43df333..e1169a3 100644 --- a/R/RcppExports.R +++ b/R/RcppExports.R @@ -1,99 +1,101 @@ +## File Name: RcppExports.R +## File Version: 3.004003 # Generated by using Rcpp::compileAttributes() -> do not edit by hand # Generator token: 10BE3573-1514-4C36-9D1C-5A225CD40393 bifiesurvey_rcpp_jackknife_timss <- function(wgt, jkzone, jkrep, RR, jkfac, prbar) { - .Call('_BIFIEsurvey_bifiesurvey_rcpp_jackknife_timss', PACKAGE = 'BIFIEsurvey', wgt, jkzone, jkrep, RR, jkfac, prbar) + .Call('_BIFIEsurvey_bifiesurvey_rcpp_jackknife_timss', PACKAGE='BIFIEsurvey', wgt, jkzone, jkrep, RR, jkfac, prbar) } bifiesurvey_rcpp_bootstrap <- function(cumwgt, rand_wgt) { - .Call('_BIFIEsurvey_bifiesurvey_rcpp_bootstrap', PACKAGE = 'BIFIEsurvey', cumwgt, rand_wgt) + .Call('_BIFIEsurvey_bifiesurvey_rcpp_bootstrap', PACKAGE='BIFIEsurvey', cumwgt, rand_wgt) } bifiesurvey_rcpp_bifiedata2bifiecdata <- function(datalistM, Nimp) { - .Call('_BIFIEsurvey_bifiesurvey_rcpp_bifiedata2bifiecdata', PACKAGE = 'BIFIEsurvey', datalistM, Nimp) + .Call('_BIFIEsurvey_bifiesurvey_rcpp_bifiedata2bifiecdata', PACKAGE='BIFIEsurvey', datalistM, Nimp) } bifiesurvey_rcpp_bifiecdata2bifiedata <- function(datalistM_ind, datalistM_imputed, Nimp, dat1, datalistM_impindex) { - .Call('_BIFIEsurvey_bifiesurvey_rcpp_bifiecdata2bifiedata', PACKAGE = 'BIFIEsurvey', datalistM_ind, datalistM_imputed, Nimp, dat1, datalistM_impindex) + .Call('_BIFIEsurvey_bifiesurvey_rcpp_bifiecdata2bifiedata', PACKAGE='BIFIEsurvey', datalistM_ind, datalistM_imputed, Nimp, dat1, datalistM_impindex) } bifiesurvey_rcpp_bifiedata_stepwise <- function(dat1, dat_ind, Nmiss) { - .Call('_BIFIEsurvey_bifiesurvey_rcpp_bifiedata_stepwise', PACKAGE = 'BIFIEsurvey', dat1, dat_ind, Nmiss) + .Call('_BIFIEsurvey_bifiesurvey_rcpp_bifiedata_stepwise', PACKAGE='BIFIEsurvey', dat1, dat_ind, Nmiss) } bifiesurvey_rcpp_linreg <- function(datalist, wgt1, wgtrep, dep_index, pre_index, fayfac, NI, group_index1, group_values) { - .Call('_BIFIEsurvey_bifiesurvey_rcpp_linreg', PACKAGE = 'BIFIEsurvey', datalist, wgt1, wgtrep, dep_index, pre_index, fayfac, NI, group_index1, group_values) + .Call('_BIFIEsurvey_bifiesurvey_rcpp_linreg', PACKAGE='BIFIEsurvey', datalist, wgt1, wgtrep, dep_index, pre_index, fayfac, NI, group_index1, group_values) } bifiesurvey_rcpp_logistreg <- function(datalist, wgt1, wgtrep, dep_index, pre_index, fayfac, NI, group_index1, group_values, eps, maxiter) { - .Call('_BIFIEsurvey_bifiesurvey_rcpp_logistreg', PACKAGE = 'BIFIEsurvey', datalist, wgt1, wgtrep, dep_index, pre_index, fayfac, NI, group_index1, group_values, eps, maxiter) + .Call('_BIFIEsurvey_bifiesurvey_rcpp_logistreg', PACKAGE='BIFIEsurvey', datalist, wgt1, wgtrep, dep_index, pre_index, fayfac, NI, group_index1, group_values, eps, maxiter) } univar_multiple_V2group <- function(datalist, wgt1, wgtrep, vars_index, fayfac, NI, group_index1, group_values) { - .Call('_BIFIEsurvey_univar_multiple_V2group', PACKAGE = 'BIFIEsurvey', datalist, wgt1, wgtrep, vars_index, fayfac, NI, group_index1, group_values) + .Call('_BIFIEsurvey_univar_multiple_V2group', PACKAGE='BIFIEsurvey', datalist, wgt1, wgtrep, vars_index, fayfac, NI, group_index1, group_values) } bifie_freq <- function(datalist, wgt1, wgtrep, vars_index, fayfac, NI, group_index1, group_values, vars_values, vars_values_numb) { - .Call('_BIFIEsurvey_bifie_freq', PACKAGE = 'BIFIEsurvey', datalist, wgt1, wgtrep, vars_index, fayfac, NI, group_index1, group_values, vars_values, vars_values_numb) + .Call('_BIFIEsurvey_bifie_freq', PACKAGE='BIFIEsurvey', datalist, wgt1, wgtrep, vars_index, fayfac, NI, group_index1, group_values, vars_values, vars_values_numb) } bifie_correl <- function(datalist, wgt1, wgtrep, vars_index, fayfac, NI, group_index1, group_values) { - .Call('_BIFIEsurvey_bifie_correl', PACKAGE = 'BIFIEsurvey', datalist, wgt1, wgtrep, vars_index, fayfac, NI, group_index1, group_values) + .Call('_BIFIEsurvey_bifie_correl', PACKAGE='BIFIEsurvey', datalist, wgt1, wgtrep, vars_index, fayfac, NI, group_index1, group_values) } bifie_comp_vcov_within <- function(parsM, parsrepM, fayfac, RR, Nimp) { - .Call('_BIFIEsurvey_bifie_comp_vcov_within', PACKAGE = 'BIFIEsurvey', parsM, parsrepM, fayfac, RR, Nimp) + .Call('_BIFIEsurvey_bifie_comp_vcov_within', PACKAGE='BIFIEsurvey', parsM, parsrepM, fayfac, RR, Nimp) } bifie_comp_vcov <- function(parsM, parsrepM, Cdes, rdes, Ccols, fayfac) { - .Call('_BIFIEsurvey_bifie_comp_vcov', PACKAGE = 'BIFIEsurvey', parsM, parsrepM, Cdes, rdes, Ccols, fayfac) + .Call('_BIFIEsurvey_bifie_comp_vcov', PACKAGE='BIFIEsurvey', parsM, parsrepM, Cdes, rdes, Ccols, fayfac) } bifie_test_univar <- function(mean1M, sd1M, sumweightM, GG, group_values, mean1repM, sd1repM, sumweightrepM, fayfac) { - .Call('_BIFIEsurvey_bifie_test_univar', PACKAGE = 'BIFIEsurvey', mean1M, sd1M, sumweightM, GG, group_values, mean1repM, sd1repM, sumweightrepM, fayfac) + .Call('_BIFIEsurvey_bifie_test_univar', PACKAGE='BIFIEsurvey', mean1M, sd1M, sumweightM, GG, group_values, mean1repM, sd1repM, sumweightrepM, fayfac) } bifie_crosstab <- function(datalist, wgt1, wgtrep, vars_values1, vars_index1, vars_values2, vars_index2, fayfac, NI, group_index1, group_values) { - .Call('_BIFIEsurvey_bifie_crosstab', PACKAGE = 'BIFIEsurvey', datalist, wgt1, wgtrep, vars_values1, vars_index1, vars_values2, vars_index2, fayfac, NI, group_index1, group_values) + .Call('_BIFIEsurvey_bifie_crosstab', PACKAGE='BIFIEsurvey', datalist, wgt1, wgtrep, vars_values1, vars_index1, vars_values2, vars_index2, fayfac, NI, group_index1, group_values) } bifie_by <- function(datalist, wgt1, wgtrep, vars_index, fayfac, NI, group_index1, group_values, userfct) { - .Call('_BIFIEsurvey_bifie_by', PACKAGE = 'BIFIEsurvey', datalist, wgt1, wgtrep, vars_index, fayfac, NI, group_index1, group_values, userfct) + .Call('_BIFIEsurvey_bifie_by', PACKAGE='BIFIEsurvey', datalist, wgt1, wgtrep, vars_index, fayfac, NI, group_index1, group_values, userfct) } bifie_hist <- function(datalist, wgt1, wgtrep, vars_index, fayfac, NI, group_index1, group_values, breaks) { - .Call('_BIFIEsurvey_bifie_hist', PACKAGE = 'BIFIEsurvey', datalist, wgt1, wgtrep, vars_index, fayfac, NI, group_index1, group_values, breaks) + .Call('_BIFIEsurvey_bifie_hist', PACKAGE='BIFIEsurvey', datalist, wgt1, wgtrep, vars_index, fayfac, NI, group_index1, group_values, breaks) } bifie_ecdf <- function(datalist, wgt1, wgtrep, vars_index, fayfac, NI, group_index1, group_values, breaks, quanttype, maxval) { - .Call('_BIFIEsurvey_bifie_ecdf', PACKAGE = 'BIFIEsurvey', datalist, wgt1, wgtrep, vars_index, fayfac, NI, group_index1, group_values, breaks, quanttype, maxval) + .Call('_BIFIEsurvey_bifie_ecdf', PACKAGE='BIFIEsurvey', datalist, wgt1, wgtrep, vars_index, fayfac, NI, group_index1, group_values, breaks, quanttype, maxval) } bifie_fasttable <- function(datavec) { - .Call('_BIFIEsurvey_bifie_fasttable', PACKAGE = 'BIFIEsurvey', datavec) + .Call('_BIFIEsurvey_bifie_fasttable', PACKAGE='BIFIEsurvey', datavec) } bifie_table1_character <- function(datavec) { - .Call('_BIFIEsurvey_bifie_table1_character', PACKAGE = 'BIFIEsurvey', datavec) + .Call('_BIFIEsurvey_bifie_table1_character', PACKAGE='BIFIEsurvey', datavec) } bifie_mla2 <- function(X_list, Z_list, y_list, wgttot, wgtlev2, wgtlev1, globconv, maxiter, group, group_values, cluster, wgtrep, Nimp, fayfac, recov_constraint, is_rcov_constraint) { - .Call('_BIFIEsurvey_bifie_mla2', PACKAGE = 'BIFIEsurvey', X_list, Z_list, y_list, wgttot, wgtlev2, wgtlev1, globconv, maxiter, group, group_values, cluster, wgtrep, Nimp, fayfac, recov_constraint, is_rcov_constraint) + .Call('_BIFIEsurvey_bifie_mla2', PACKAGE='BIFIEsurvey', X_list, Z_list, y_list, wgttot, wgtlev2, wgtlev1, globconv, maxiter, group, group_values, cluster, wgtrep, Nimp, fayfac, recov_constraint, is_rcov_constraint) } bifiesurvey_rcpp_replication_variance <- function(pars, pars_repl, fay_factor) { - .Call('_BIFIEsurvey_bifiesurvey_rcpp_replication_variance', PACKAGE = 'BIFIEsurvey', pars, pars_repl, fay_factor) + .Call('_BIFIEsurvey_bifiesurvey_rcpp_replication_variance', PACKAGE='BIFIEsurvey', pars, pars_repl, fay_factor) } bifiesurvey_rcpp_rubin_rules <- function(estimates, variances) { - .Call('_BIFIEsurvey_bifiesurvey_rcpp_rubin_rules', PACKAGE = 'BIFIEsurvey', estimates, variances) + .Call('_BIFIEsurvey_bifiesurvey_rcpp_rubin_rules', PACKAGE='BIFIEsurvey', estimates, variances) } bifiesurvey_rcpp_pathmodel <- function(datalist, wgt1, wgtrep, vars_index, fayfac, NI, group_index1, group_values, L, L_row_index, NL, E, R, R_row_index, coeff_index, NP0, unreliability) { - .Call('_BIFIEsurvey_bifiesurvey_rcpp_pathmodel', PACKAGE = 'BIFIEsurvey', datalist, wgt1, wgtrep, vars_index, fayfac, NI, group_index1, group_values, L, L_row_index, NL, E, R, R_row_index, coeff_index, NP0, unreliability) + .Call('_BIFIEsurvey_bifiesurvey_rcpp_pathmodel', PACKAGE='BIFIEsurvey', datalist, wgt1, wgtrep, vars_index, fayfac, NI, group_index1, group_values, L, L_row_index, NL, E, R, R_row_index, coeff_index, NP0, unreliability) } bifiesurvey_rcpp_wald_test <- function(parsM, parsrepM, Cdes, rdes, Ccols, fayfac) { - .Call('_BIFIEsurvey_bifiesurvey_rcpp_wald_test', PACKAGE = 'BIFIEsurvey', parsM, parsrepM, Cdes, rdes, Ccols, fayfac) + .Call('_BIFIEsurvey_bifiesurvey_rcpp_wald_test', PACKAGE='BIFIEsurvey', parsM, parsrepM, Cdes, rdes, Ccols, fayfac) } diff --git a/README.md b/README.md index 90547ad..a39bbbe 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,7 @@ #### Tools for Survey Statistics in Educational Assessment -If you use `BIFIEsurvey` and have suggestions for improvement or have found bugs, please email me at robitzsch@ipn.uni-kiel.de. +If you use `BIFIEsurvey` and have suggestions for improvement or have found bugs, please email me at robitzsch@leibniz-ipn.de. #### Manual @@ -22,9 +22,9 @@ The CRAN version can be installed from within R using: utils::install.packages("BIFIEsurvey") ``` -#### GitHub version `BIFIEsurvey` 3.4-1 (2019-06-12) +#### GitHub version `BIFIEsurvey` 3.4-3 (2020-07-24) -[![](https://img.shields.io/badge/github%20version-3.4--1-orange.svg)](https://github.com/alexanderrobitzsch/BIFIEsurvey)   +[![](https://img.shields.io/badge/github%20version-3.4--3-orange.svg)](https://github.com/alexanderrobitzsch/BIFIEsurvey)   The version hosted [here](https://github.com/alexanderrobitzsch/BIFIEsurvey) is the development version of `BIFIEsurvey`. The GitHub version can be installed using `devtools` as: diff --git a/docs/404.html b/docs/404.html new file mode 100644 index 0000000..c10b7bc --- /dev/null +++ b/docs/404.html @@ -0,0 +1,145 @@ + + + + + + + + +Page not found (404) • BIFIEsurvey + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
+ + + + +
+ +
+
+ + +Content not found. Please use links in the navbar. + +
+ + + +
+ + + +
+ + +
+

Site built with pkgdown 1.5.1.

+
+ +
+
+ + + + + + + + diff --git a/docs/authors.html b/docs/authors.html index bd3827e..81e3f64 100644 --- a/docs/authors.html +++ b/docs/authors.html @@ -8,21 +8,29 @@ Citation and Authors • BIFIEsurvey + - + - + + - + + + + + - + + - + - - + + + @@ -30,10 +38,12 @@ + + @@ -44,9 +54,10 @@ + - +
@@ -68,7 +79,7 @@ -
+
@@ -100,17 +111,15 @@

Citation

Source: inst/CITATION
-

BIFIE, Robitzsch A, Oberwimmer K (2019). -BIFIEsurvey: Tools for survey statistics in educational assessment. -R package version 3.4-1, https://CRAN.R-project.org/package=BIFIEsurvey. -

+

BIFIE, Robitzsch, A., & Oberwimmer, K. (2020). BIFIEsurvey: Tools for survey statistics in educational assessment. R package version 3.4-3. https://CRAN.R-project.org/package=BIFIEsurvey

@Manual{,
   title = {BIFIEsurvey: Tools for survey statistics in educational assessment},
   author = {{BIFIE} and Alexander Robitzsch and Konrad Oberwimmer},
-  year = {2019},
-  note = {R package version 3.4-1},
+  year = {2020},
+  note = {R package version 3.4-3},
   url = {https://CRAN.R-project.org/package=BIFIEsurvey},
 }
+ @@ -127,19 +136,23 @@

Authors

+
-

Site built with pkgdown 1.3.0.

+

Site built with pkgdown 1.5.1.

+
+ + diff --git a/docs/bootstrap-toc.css b/docs/bootstrap-toc.css new file mode 100644 index 0000000..5a85941 --- /dev/null +++ b/docs/bootstrap-toc.css @@ -0,0 +1,60 @@ +/*! + * Bootstrap Table of Contents v0.4.1 (http://afeld.github.io/bootstrap-toc/) + * Copyright 2015 Aidan Feldman + * Licensed under MIT (https://github.com/afeld/bootstrap-toc/blob/gh-pages/LICENSE.md) */ + +/* modified from https://github.com/twbs/bootstrap/blob/94b4076dd2efba9af71f0b18d4ee4b163aa9e0dd/docs/assets/css/src/docs.css#L548-L601 */ + +/* All levels of nav */ +nav[data-toggle='toc'] .nav > li > a { + display: block; + padding: 4px 20px; + font-size: 13px; + font-weight: 500; + color: #767676; +} +nav[data-toggle='toc'] .nav > li > a:hover, +nav[data-toggle='toc'] .nav > li > a:focus { + padding-left: 19px; + color: #563d7c; + text-decoration: none; + background-color: transparent; + border-left: 1px solid #563d7c; +} +nav[data-toggle='toc'] .nav > .active > a, +nav[data-toggle='toc'] .nav > .active:hover > a, +nav[data-toggle='toc'] .nav > .active:focus > a { + padding-left: 18px; + font-weight: bold; + color: #563d7c; + background-color: transparent; + border-left: 2px solid #563d7c; +} + +/* Nav: second level (shown on .active) */ +nav[data-toggle='toc'] .nav .nav { + display: none; /* Hide by default, but at >768px, show it */ + padding-bottom: 10px; +} +nav[data-toggle='toc'] .nav .nav > li > a { + padding-top: 1px; + padding-bottom: 1px; + padding-left: 30px; + font-size: 12px; + font-weight: normal; +} +nav[data-toggle='toc'] .nav .nav > li > a:hover, +nav[data-toggle='toc'] .nav .nav > li > a:focus { + padding-left: 29px; +} +nav[data-toggle='toc'] .nav .nav > .active > a, +nav[data-toggle='toc'] .nav .nav > .active:hover > a, +nav[data-toggle='toc'] .nav .nav > .active:focus > a { + padding-left: 28px; + font-weight: 500; +} + +/* from https://github.com/twbs/bootstrap/blob/e38f066d8c203c3e032da0ff23cd2d6098ee2dd6/docs/assets/css/src/docs.css#L631-L634 */ +nav[data-toggle='toc'] .nav > .active > ul { + display: block; +} diff --git a/docs/bootstrap-toc.js b/docs/bootstrap-toc.js new file mode 100644 index 0000000..1cdd573 --- /dev/null +++ b/docs/bootstrap-toc.js @@ -0,0 +1,159 @@ +/*! + * Bootstrap Table of Contents v0.4.1 (http://afeld.github.io/bootstrap-toc/) + * Copyright 2015 Aidan Feldman + * Licensed under MIT (https://github.com/afeld/bootstrap-toc/blob/gh-pages/LICENSE.md) */ +(function() { + 'use strict'; + + window.Toc = { + helpers: { + // return all matching elements in the set, or their descendants + findOrFilter: function($el, selector) { + // http://danielnouri.org/notes/2011/03/14/a-jquery-find-that-also-finds-the-root-element/ + // http://stackoverflow.com/a/12731439/358804 + var $descendants = $el.find(selector); + return $el.filter(selector).add($descendants).filter(':not([data-toc-skip])'); + }, + + generateUniqueIdBase: function(el) { + var text = $(el).text(); + var anchor = text.trim().toLowerCase().replace(/[^A-Za-z0-9]+/g, '-'); + return anchor || el.tagName.toLowerCase(); + }, + + generateUniqueId: function(el) { + var anchorBase = this.generateUniqueIdBase(el); + for (var i = 0; ; i++) { + var anchor = anchorBase; + if (i > 0) { + // add suffix + anchor += '-' + i; + } + // check if ID already exists + if (!document.getElementById(anchor)) { + return anchor; + } + } + }, + + generateAnchor: function(el) { + if (el.id) { + return el.id; + } else { + var anchor = this.generateUniqueId(el); + el.id = anchor; + return anchor; + } + }, + + createNavList: function() { + return $(''); + }, + + createChildNavList: function($parent) { + var $childList = this.createNavList(); + $parent.append($childList); + return $childList; + }, + + generateNavEl: function(anchor, text) { + var $a = $(''); + $a.attr('href', '#' + anchor); + $a.text(text); + var $li = $('
  • '); + $li.append($a); + return $li; + }, + + generateNavItem: function(headingEl) { + var anchor = this.generateAnchor(headingEl); + var $heading = $(headingEl); + var text = $heading.data('toc-text') || $heading.text(); + return this.generateNavEl(anchor, text); + }, + + // Find the first heading level (`

    `, then `

    `, etc.) that has more than one element. Defaults to 1 (for `

    `). + getTopLevel: function($scope) { + for (var i = 1; i <= 6; i++) { + var $headings = this.findOrFilter($scope, 'h' + i); + if ($headings.length > 1) { + return i; + } + } + + return 1; + }, + + // returns the elements for the top level, and the next below it + getHeadings: function($scope, topLevel) { + var topSelector = 'h' + topLevel; + + var secondaryLevel = topLevel + 1; + var secondarySelector = 'h' + secondaryLevel; + + return this.findOrFilter($scope, topSelector + ',' + secondarySelector); + }, + + getNavLevel: function(el) { + return parseInt(el.tagName.charAt(1), 10); + }, + + populateNav: function($topContext, topLevel, $headings) { + var $context = $topContext; + var $prevNav; + + var helpers = this; + $headings.each(function(i, el) { + var $newNav = helpers.generateNavItem(el); + var navLevel = helpers.getNavLevel(el); + + // determine the proper $context + if (navLevel === topLevel) { + // use top level + $context = $topContext; + } else if ($prevNav && $context === $topContext) { + // create a new level of the tree and switch to it + $context = helpers.createChildNavList($prevNav); + } // else use the current $context + + $context.append($newNav); + + $prevNav = $newNav; + }); + }, + + parseOps: function(arg) { + var opts; + if (arg.jquery) { + opts = { + $nav: arg + }; + } else { + opts = arg; + } + opts.$scope = opts.$scope || $(document.body); + return opts; + } + }, + + // accepts a jQuery object, or an options object + init: function(opts) { + opts = this.helpers.parseOps(opts); + + // ensure that the data attribute is in place for styling + opts.$nav.attr('data-toggle', 'toc'); + + var $topContext = this.helpers.createChildNavList(opts.$nav); + var topLevel = this.helpers.getTopLevel(opts.$scope); + var $headings = this.helpers.getHeadings(opts.$scope, topLevel); + this.helpers.populateNav($topContext, topLevel, $headings); + } + }; + + $(function() { + $('nav[data-toggle="toc"]').each(function(i, el) { + var $nav = $(el); + Toc.init($nav); + }); + }); +})(); diff --git a/docs/index.html b/docs/index.html index a6040f2..ed01404 100644 --- a/docs/index.html +++ b/docs/index.html @@ -6,9 +6,11 @@ Tools for Survey Statistics in Educational Assessment • BIFIEsurvey - - - + + + + + - - +
    @@ -88,12 +90,18 @@

    Tools for Survey Statistics in Educational Assessment

    -

    If you use BIFIEsurvey and have suggestions for improvement or have found bugs, please email me at .

    +

    If you use BIFIEsurvey and have suggestions for improvement or have found bugs, please email me at

    +.

    Manual

    -

    The manual may be found here https://alexanderrobitzsch.github.io/BIFIEsurvey/

    +

    The manual may be found here https://alexanderrobitzsch.github.io/BIFIEsurvey/

    @@ -103,24 +111,24 @@

       -->

    The official version of BIFIEsurvey is hosted on CRAN and may be found here. The CRAN version can be installed from within R using:

    - +
    utils::install.packages("BIFIEsurvey")

    GitHub version

    The version hosted here is the development version of BIFIEsurvey. The GitHub version can be installed using devtools as:

    -
    devtools::install_github("alexanderrobitzsch/BIFIEsurvey")
    +
    devtools::install_github("alexanderrobitzsch/BIFIEsurvey")
    - +
    -

    Site built with pkgdown 1.3.0.

    +

    Site built with pkgdown 1.5.1.

    +
    + diff --git a/docs/pkgdown.css b/docs/pkgdown.css index c03fb08..c01e592 100644 --- a/docs/pkgdown.css +++ b/docs/pkgdown.css @@ -17,12 +17,14 @@ html, body { height: 100%; } +body { + position: relative; +} + body > .container { display: flex; height: 100%; flex-direction: column; - - padding-top: 60px; } body > .container .row { @@ -69,6 +71,10 @@ summary { margin-top: calc(-60px + 1em); } +dd { + margin-left: 3em; +} + /* Section anchors ---------------------------------*/ a.anchor { @@ -102,37 +108,135 @@ a.anchor { margin-top: -40px; } -/* Static header placement on mobile devices */ -@media (max-width: 767px) { - .navbar-fixed-top { - position: absolute; - } - .navbar { - padding: 0; - } +/* Navbar submenu --------------------------*/ + +.dropdown-submenu { + position: relative; } +.dropdown-submenu>.dropdown-menu { + top: 0; + left: 100%; + margin-top: -6px; + margin-left: -1px; + border-radius: 0 6px 6px 6px; +} + +.dropdown-submenu:hover>.dropdown-menu { + display: block; +} + +.dropdown-submenu>a:after { + display: block; + content: " "; + float: right; + width: 0; + height: 0; + border-color: transparent; + border-style: solid; + border-width: 5px 0 5px 5px; + border-left-color: #cccccc; + margin-top: 5px; + margin-right: -10px; +} + +.dropdown-submenu:hover>a:after { + border-left-color: #ffffff; +} + +.dropdown-submenu.pull-left { + float: none; +} + +.dropdown-submenu.pull-left>.dropdown-menu { + left: -100%; + margin-left: 10px; + border-radius: 6px 0 6px 6px; +} /* Sidebar --------------------------*/ -#sidebar { +#pkgdown-sidebar { margin-top: 30px; + position: -webkit-sticky; + position: sticky; + top: 70px; } -#sidebar h2 { + +#pkgdown-sidebar h2 { font-size: 1.5em; margin-top: 1em; } -#sidebar h2:first-child { +#pkgdown-sidebar h2:first-child { margin-top: 0; } -#sidebar .list-unstyled li { +#pkgdown-sidebar .list-unstyled li { margin-bottom: 0.5em; } +/* bootstrap-toc tweaks ------------------------------------------------------*/ + +/* All levels of nav */ + +nav[data-toggle='toc'] .nav > li > a { + padding: 4px 20px 4px 6px; + font-size: 1.5rem; + font-weight: 400; + color: inherit; +} + +nav[data-toggle='toc'] .nav > li > a:hover, +nav[data-toggle='toc'] .nav > li > a:focus { + padding-left: 5px; + color: inherit; + border-left: 1px solid #878787; +} + +nav[data-toggle='toc'] .nav > .active > a, +nav[data-toggle='toc'] .nav > .active:hover > a, +nav[data-toggle='toc'] .nav > .active:focus > a { + padding-left: 5px; + font-size: 1.5rem; + font-weight: 400; + color: inherit; + border-left: 2px solid #878787; +} + +/* Nav: second level (shown on .active) */ + +nav[data-toggle='toc'] .nav .nav { + display: none; /* Hide by default, but at >768px, show it */ + padding-bottom: 10px; +} + +nav[data-toggle='toc'] .nav .nav > li > a { + padding-left: 16px; + font-size: 1.35rem; +} + +nav[data-toggle='toc'] .nav .nav > li > a:hover, +nav[data-toggle='toc'] .nav .nav > li > a:focus { + padding-left: 15px; +} + +nav[data-toggle='toc'] .nav .nav > .active > a, +nav[data-toggle='toc'] .nav .nav > .active:hover > a, +nav[data-toggle='toc'] .nav .nav > .active:focus > a { + padding-left: 15px; + font-weight: 500; + font-size: 1.35rem; +} + +/* orcid ------------------------------------------------------------------- */ + .orcid { - height: 16px; + font-size: 16px; + color: #A6CE39; + /* margins are required by official ORCID trademark and display guidelines */ + margin-left:4px; + margin-right:4px; vertical-align: middle; } @@ -222,6 +326,19 @@ a.sourceLine:hover { visibility: visible; } +/* headroom.js ------------------------ */ + +.headroom { + will-change: transform; + transition: transform 200ms linear; +} +.headroom--pinned { + transform: translateY(0%); +} +.headroom--unpinned { + transform: translateY(-100%); +} + /* mark.js ----------------------------*/ mark { @@ -234,3 +351,17 @@ mark { .html-widget { margin-bottom: 10px; } + +/* fontawesome ------------------------ */ + +.fab { + font-family: "Font Awesome 5 Brands" !important; +} + +/* don't display links in code chunks when printing */ +/* source: https://stackoverflow.com/a/10781533 */ +@media print { + code a:link:after, code a:visited:after { + content: ""; + } +} diff --git a/docs/pkgdown.js b/docs/pkgdown.js index eb7e83d..7e7048f 100644 --- a/docs/pkgdown.js +++ b/docs/pkgdown.js @@ -2,18 +2,11 @@ (function($) { $(function() { - $("#sidebar") - .stick_in_parent({offset_top: 40}) - .on('sticky_kit:bottom', function(e) { - $(this).parent().css('position', 'static'); - }) - .on('sticky_kit:unbottom', function(e) { - $(this).parent().css('position', 'relative'); - }); + $('.navbar-fixed-top').headroom(); - $('body').scrollspy({ - target: '#sidebar', - offset: 60 + $('body').css('padding-top', $('.navbar').height() + 10); + $(window).resize(function(){ + $('body').css('padding-top', $('.navbar').height() + 10); }); $('[data-toggle="tooltip"]').tooltip(); diff --git a/docs/pkgdown.yml b/docs/pkgdown.yml index 06304c0..24a9d72 100644 --- a/docs/pkgdown.yml +++ b/docs/pkgdown.yml @@ -1,5 +1,6 @@ -pandoc: '2.6' -pkgdown: 1.3.0 +pandoc: 1.13.1 +pkgdown: 1.5.1 pkgdown_sha: ~ articles: [] +last_built: 2020-07-24T16:40Z diff --git a/docs/reference/BIFIE.BIFIEdata2BIFIEcdata.html b/docs/reference/BIFIE.BIFIEdata2BIFIEcdata.html index 296ba0e..abbfe60 100644 --- a/docs/reference/BIFIE.BIFIEdata2BIFIEcdata.html +++ b/docs/reference/BIFIE.BIFIEdata2BIFIEcdata.html @@ -8,21 +8,29 @@ Conversion and Selection of <code>BIFIEdata</code> Objects — BIFIE.BIFIEdata2BIFIEcdata • BIFIEsurvey + - + - + + - + + + + + - + + - + - - + + + @@ -30,8 +38,8 @@ - + - + @@ -54,9 +62,10 @@ + - +
    +
    @@ -112,7 +121,6 @@

    Conversion and Selection of BIFIEdata Objects

    -

    Functions for converting and selecting objects of class BIFIEdata. The function BIFIE.BIFIEdata2BIFIEcdata converts the BIFIEdata objects in a non-compact form (cdata=FALSE) into an object of @@ -121,7 +129,6 @@

    Conversion and Selection of BIFIEdata Objects

    The function BIFIE.BIFIEdata2datalist converts a (part) of the object of class BIFIEdata into a list of multiply-imputed datasets.

    -
    BIFIE.BIFIEdata2BIFIEcdata(bifieobj, varnames=NULL, impdata.index=NULL)
    @@ -130,7 +137,7 @@ 

    Conversion and Selection of BIFIEdata Objects

    BIFIE.BIFIEdata2datalist(bifieobj, varnames=NULL, impdata.index=NULL, as_data_frame=FALSE)
    - +

    Arguments

    @@ -152,105 +159,98 @@

    Arg be converted into a data frame

    - +

    Value

    An object of class BIFIEdata saved in a non-compact or compact way, see value cdata.

    -

    See also

    -

    Examples

    -
    # NOT RUN {
    -#############################################################################
    +    
    #############################################################################
     # EXAMPLE 1: BIFIEdata conversions using data.timss1 dataset
     #############################################################################
    -data(data.timss1)
    -data(data.timssrep)
    +data(data.timss1)
    +data(data.timssrep)
     
     # create BIFIEdata object
    -bdat1 <- BIFIEsurvey::BIFIE.data( data.list=data.timss1, wgt=data.timss1[[1]]$TOTWGT,
    +bdat1 <- BIFIEsurvey::BIFIE.data( data.list=data.timss1, wgt=data.timss1[[1]]$TOTWGT,
                 wgtrep=data.timssrep[, -1 ])
    -summary(bdat1)
    +summary(bdat1)
     
     # convert BIFIEdata object bdat1 into a BIFIEcdata object with
     #  only using the first three datasets and a variable selection
    -bdat2 <- BIFIEsurvey::BIFIE.BIFIEdata2BIFIEcdata( bifieobj=bdat1,
    -                varnames=bdat1$varnames[ c(1:7,10) ] )
    +bdat2 <- BIFIEsurvey::BIFIE.BIFIEdata2BIFIEcdata( bifieobj=bdat1,
    +                varnames=bdat1$varnames[ c(1:7,10) ] )
     
     # convert bdat2 into BIFIEdata object and only use the first three imputed datasets
    -bdat3 <- BIFIEsurvey::BIFIE.BIFIEcdata2BIFIEdata( bifieobj=bdat2, impdata.index=1:3)
    +bdat3 <- BIFIEsurvey::BIFIE.BIFIEcdata2BIFIEdata( bifieobj=bdat2, impdata.index=1:3)
     
     # object summaries
    -summary(bdat1)
    -summary(bdat2)
    -summary(bdat3)
    +summary(bdat1)
    +summary(bdat2)
    +summary(bdat3)
     
    -# }# NOT RUN {
    +if (FALSE) {
     #############################################################################
     # EXAMPLE 2: Extract unique elements in BIFIEdata object
     #############################################################################
     
    -data(data.timss1)
    -data(data.timssrep)
    +data(data.timss1)
    +data(data.timssrep)
     
     # create BIFIEdata object
    -bifieobj <- BIFIEsurvey::BIFIE.data( data.list=data.timss1, wgt=data.timss1[[1]]$TOTWGT,
    +bifieobj <- BIFIEsurvey::BIFIE.data( data.list=data.timss1, wgt=data.timss1[[1]]$TOTWGT,
                 wgtrep=data.timssrep[, -1 ])
    -summary(bifieobj)
    +summary(bifieobj)
     
     # define variables for which unique values should be extracted
    -vars <- c( "female", "books","ASMMAT" )
    +vars <- c( "female", "books","ASMMAT" )
     # convert these variables from BIFIEdata object into a list of datasets
    -bdatlist <- BIFIEsurvey::BIFIE.BIFIEdata2datalist( bifieobj, varnames=vars )
    +bdatlist <- BIFIEsurvey::BIFIE.BIFIEdata2datalist( bifieobj, varnames=vars )
     # look for unique values in first dataset for variables
    -values <- lapply( bdatlist[[1]], FUN=function(vv){
    -                sort( unique( vv ) ) } )
    +values <- lapply( bdatlist[[1]], FUN=function(vv){
    +                sort( unique( vv ) ) } )
     # number of unique values in first dataset
    -Nvalues <- lapply( bdatlist[[1]], FUN=function(vv){
    -                length( unique( vv ) ) } )
    +Nvalues <- lapply( bdatlist[[1]], FUN=function(vv){
    +                length( unique( vv ) ) } )
     # number of unique values in all datasets
    -Nvalues2 <- lapply( vars, FUN=function(vv){
    +Nvalues2 <- lapply( vars, FUN=function(vv){
         #vv <- vars[1]
    -    unlist( lapply( bdatlist, FUN=function(dd){
    -                length( unique( dd[,vv]  ) )
    +    unlist( lapply( bdatlist, FUN=function(dd){
    +                length( unique( dd[,vv]  ) )
                             }    )     )
                         } )
     # --> for extracting the number of unique values using BIFIE.by and a user
     #     defined function see Example 1, Model 3 in "BIFIE.by"
    -# }
    +}
    - +
    -

    Site built with pkgdown 1.3.0.

    +

    Site built with pkgdown 1.5.1.

    +
    + + diff --git a/docs/reference/BIFIE.by.html b/docs/reference/BIFIE.by.html index 811f234..0d07596 100644 --- a/docs/reference/BIFIE.by.html +++ b/docs/reference/BIFIE.by.html @@ -8,21 +8,29 @@ Statistics for User Defined Functions — BIFIE.by • BIFIEsurvey + - + - + + - + + + + + - + + - + - - + + + @@ -30,10 +38,10 @@ - + - + @@ -47,9 +55,10 @@ + - +
    +
    @@ -105,23 +114,21 @@

    Statistics for User Defined Functions

    -

    Computes statistics for user defined functions.

    -
    BIFIE.by( BIFIEobj, vars, userfct, userparnames=NULL,
          group=NULL, group_values=NULL, se=TRUE, use_Rcpp=TRUE)
     
     # S3 method for BIFIE.by
    -summary(object,digits=4,...)
    +summary(object,digits=4,...)
     
     # S3 method for BIFIE.by
    -coef(object,...)
    +coef(object,...)
     
     # S3 method for BIFIE.by
    -vcov(object,...)
    - +vcov(object,...) +

    Arguments

    @@ -172,121 +179,118 @@

    Arg

    - +

    Number of digits for rounding output

    ...

    Further arguments to be passed

    - +

    Value

    A list with following entries

    stat

    Data frame with statistics defined in userfct

    output

    Extensive output with all replicated statistics

    -

    More values

    +
    ...

    More values

    -

    See also

    - - +

    Examples

    -
    # NOT RUN {
    -#############################################################################
    +    
    #############################################################################
     # EXAMPLE 1: Imputed TIMSS dataset
     #############################################################################
     
    -data(data.timss1)
    -data(data.timssrep)
    +data(data.timss1)
    +data(data.timssrep)
     
     # create BIFIE.dat object
    -bifieobj <- BIFIEsurvey::BIFIE.data( data.list=data.timss1, wgt=data.timss1[[1]]$TOTWGT,
    +bifieobj <- BIFIEsurvey::BIFIE.data( data.list=data.timss1, wgt=data.timss1[[1]]$TOTWGT,
                wgtrep=data.timssrep[, -1 ] )
     
     #****************************
     #*** Model 1: Weighted means (as a toy example)
     userfct <- function(X,w){
    -        pars <- c( stats::weighted.mean( X[,1], w ),
    -                     stats::weighted.mean(X[,2], w )   )
    -        return(pars)
    +        pars <- c( stats::weighted.mean( X[,1], w ),
    +                     stats::weighted.mean(X[,2], w )   )
    +        return(pars)
                             }
    -res1 <-  BIFIEsurvey::BIFIE.by( bifieobj, vars=c("ASMMAT", "migrant", "books"),
    -                userfct=userfct, userparnames=c("MW_MAT", "MW_Migr"),
    +res1 <-  BIFIEsurvey::BIFIE.by( bifieobj, vars=c("ASMMAT", "migrant", "books"),
    +                userfct=userfct, userparnames=c("MW_MAT", "MW_Migr"),
                     group="female" )
    -summary(res1)
    +summary(res1)
     
     # evaluate function in pure R implementation using the use_Rcpp argument
    -res1b <-  BIFIEsurvey::BIFIE.by( bifieobj, vars=c("ASMMAT", "migrant", "books" ),
    -                userfct=userfct, userparnames=c("MW_MAT", "MW_Migr"),
    +res1b <-  BIFIEsurvey::BIFIE.by( bifieobj, vars=c("ASMMAT", "migrant", "books" ),
    +                userfct=userfct, userparnames=c("MW_MAT", "MW_Migr"),
                     group="female", use_Rcpp=FALSE )
    -summary(res1b)
    +summary(res1b)
     
     #--- statistical inference for a derived parameter (see ?BIFIE.derivedParameters)
     # define gender difference for mathematics score (divided by 100)
    -derived.parameters <- list(
    -        "gender_diff"=~ 0 + I( ( MW_MAT_female1 - MW_MAT_female0 ) / 100 )
    +derived.parameters <- list(
    +        "gender_diff"=~ 0 + I( ( MW_MAT_female1 - MW_MAT_female0 ) / 100 )
                                 )
     # inference derived parameter
    -res1d <- BIFIEsurvey::BIFIE.derivedParameters( res1,
    +res1d <- BIFIEsurvey::BIFIE.derivedParameters( res1,
                     derived.parameters=derived.parameters )
    -summary(res1d)
    +summary(res1d)
     
    -# }# NOT RUN {
    +if (FALSE) {
     #****************************
     #**** Model 2: Robust linear model
     
     # (1) start from scratch to formulate the user function for X and w
     dat1 <- bifieobj$dat1
    -vars <- c("ASMMAT", "migrant", "books" )
    +vars <- c("ASMMAT", "migrant", "books" )
     X <- dat1[,vars]
     w <- bifieobj$wgt
    -library(MASS)
    +library(MASS)
     # ASMMAT ~ migrant + books
    -mod <- MASS::rlm( X[,1] ~  as.matrix( X[, -1 ] ), weights=w )
    -coef(mod)
    +mod <- MASS::rlm( X[,1] ~  as.matrix( X[, -1 ] ), weights=w )
    +coef(mod)
     # (2) define a user function "my_rlm"
     my_rlm <- function(X,w){
    -    mod <- MASS::rlm( X[,1] ~  as.matrix( X[, -1 ] ), weights=w )
    -    return( coef(mod) )
    +    mod <- MASS::rlm( X[,1] ~  as.matrix( X[, -1 ] ), weights=w )
    +    return( coef(mod) )
                     }
     # (3) estimate model
    -res2 <-  BIFIEsurvey::BIFIE.by( bifieobj, vars, userfct=my_rlm,
    +res2 <-  BIFIEsurvey::BIFIE.by( bifieobj, vars, userfct=my_rlm,
                     group="female", group_values=0:1)
    -summary(res2)
    +summary(res2)
     # estimate model without computing standard errors
    -res2a <-  BIFIEsurvey::BIFIE.by( bifieobj, vars, userfct=my_rlm,
    +res2a <-  BIFIEsurvey::BIFIE.by( bifieobj, vars, userfct=my_rlm,
                     group="female", se=FALSE)
    -summary(res2a)
    +summary(res2a)
     
     # define a user function with formula language
     my_rlm2 <- function(X,w){
    -    colnames(X) <- vars
    -    X <- as.data.frame(X)
    -    mod <- MASS::rlm( ASMMAT ~  migrant + books, weights=w, data=X)
    -    return( coef(mod) )
    +    colnames(X) <- vars
    +    X <- as.data.frame(X)
    +    mod <- MASS::rlm( ASMMAT ~  migrant + books, weights=w, data=X)
    +    return( coef(mod) )
                     }
     # estimate model
    -res2b <-  BIFIEsurvey::BIFIE.by( bifieobj, vars, userfct=my_rlm2,
    +res2b <-  BIFIEsurvey::BIFIE.by( bifieobj, vars, userfct=my_rlm2,
                     group="female", group_values=0:1)
    -summary(res2b)
    +summary(res2b)
     
     
     #****************************
     #**** Model 3: Number of unique values for variables in BIFIEdata
     
     #*** define variables for which the number of unique values should be calculated
    -vars <- c( "female", "books","ASMMAT" )
    +vars <- c( "female", "books","ASMMAT" )
     #*** define a user function extracting these unqiue values
     userfct <- function(X,w){
    -        pars <- apply( X, 2, FUN=function(vv){
    -                     length( unique(vv))  } )
    +        pars <- apply( X, 2, FUN=function(vv){
    +                     length( unique(vv))  } )
             # Note that weights are (of course) ignored in this function
    -        return(pars)
    +        return(pars)
                             }
     #*** extract number of unique values
    -res3 <-  BIFIEsurvey::BIFIE.by( bifieobj, vars=vars, userfct=userfct,
    -              userparnames=paste0( vars, "_Nunique"),  se=FALSE )
    -summary(res3)
    +res3 <-  BIFIEsurvey::BIFIE.by( bifieobj, vars=vars, userfct=userfct,
    +              userparnames=paste0( vars, "_Nunique"),  se=FALSE )
    +summary(res3)
       ##   Statistical Inference for User Definition Function
       ##               parm Ncases  Nweight    est
       ##   1 female_Nunique   4668 78332.99    2.0
    @@ -314,66 +318,62 @@ 

    Examp female ~~ female " -mod0 <- lavaan::lavaan(lavmodel, data=data0, sampling.weights="TOTWGT") -summary(mod0, stand=TRUE, fit.measures=TRUE) +mod0 <- lavaan::lavaan(lavmodel, data=data0, sampling.weights="TOTWGT") +summary(mod0, stand=TRUE, fit.measures=TRUE) #* construct input for BIFIE.by -vars <- c("ASSSCI","likesc","female","TOTWGT") +vars <- c("ASSSCI","likesc","female","TOTWGT") X <- data0[,vars] -mod0 <- lavaan::lavaan(lavmodel, data=X, sampling.weights="TOTWGT") +mod0 <- lavaan::lavaan(lavmodel, data=X, sampling.weights="TOTWGT") w <- data0$TOTWGT #* define user function userfct <- function(X,w){ - X1 <- as.data.frame(X) - colnames(X1) <- vars + X1 <- as.data.frame(X) + colnames(X1) <- vars X1$studwgt <- w - mod0 <- lavaan::lavaan(lavmodel, data=X1, sampling.weights="TOTWGT") - pars <- coef(mod0) + mod0 <- lavaan::lavaan(lavmodel, data=X1, sampling.weights="TOTWGT") + pars <- coef(mod0) # extract some fit statistics - pars2 <- lavaan::fitMeasures(mod0) - pars <- c(pars, pars2[c("cfi","tli")]) - return(pars) + pars2 <- lavaan::fitMeasures(mod0) + pars <- c(pars, pars2[c("cfi","tli")]) + return(pars) } #* test function res0 <- userfct(X,w) -userparnames <- names(res0) +userparnames <- names(res0) #* estimate lavaan model with replicated sampling weights -res1 <- BIFIEsurvey::BIFIE.by( bifieobj, vars=vars, userfct=userfct, +res1 <- BIFIEsurvey::BIFIE.by( bifieobj, vars=vars, userfct=userfct, userparnames=userparnames, use_Rcpp=FALSE ) -summary(res1) -# }

    +summary(res1) +}
    - +
    -

    Site built with pkgdown 1.3.0.

    +

    Site built with pkgdown 1.5.1.

    +
    + + diff --git a/docs/reference/BIFIE.correl.html b/docs/reference/BIFIE.correl.html index ebc09eb..d0842fc 100644 --- a/docs/reference/BIFIE.correl.html +++ b/docs/reference/BIFIE.correl.html @@ -8,21 +8,29 @@ Correlations and Covariances — BIFIE.correl • BIFIEsurvey + - + - + + - + + + + + - + + - + - - + + + @@ -30,10 +38,10 @@ - + - + @@ -47,9 +55,10 @@ + - +
    +
    @@ -105,22 +114,20 @@

    Correlations and Covariances

    -

    Computes correlations and covariances

    -
    BIFIE.correl(BIFIEobj, vars, group=NULL, group_values=NULL, se=TRUE)
     
     # S3 method for BIFIE.correl
    -summary(object,digits=4, ...)
    +summary(object,digits=4, ...)
     
     # S3 method for BIFIE.correl
    -coef(object,type=NULL, ...)
    +coef(object,type=NULL, ...)
     
     # S3 method for BIFIE.correl
    -vcov(object,type=NULL, ...)
    - +vcov(object,type=NULL, ...) +

    Arguments

    @@ -160,11 +167,11 @@

    Arg correlations are extracted.

    - +
    ...

    Further arguments to be passed

    - +

    Value

    A list with following entries

    @@ -173,70 +180,62 @@

    Value

    cor_matrix

    List of estimated correlation matrices

    cov_matrix

    List of estimated covariance matrices

    output

    Extensive output with all replicated statistics

    -

    More values

    +
    ...

    More values

    -

    See also

    - - +

    stats::cov.wt, +intsvy::timss.rho, +intsvy::timss.rho.pv, +Hmisc::rcorr, +miceadds::ma.wtd.corNA

    Examples

    -
    # NOT RUN {
    -#############################################################################
    +    
    #############################################################################
     # EXAMPLE 1: Imputed TIMSS dataset
     #############################################################################
     
    -data(data.timss1)
    -data(data.timssrep)
    +data(data.timss1)
    +data(data.timssrep)
     
     # create BIFIE.dat object
    -bdat <- BIFIEsurvey::BIFIE.data( data.list=data.timss1, wgt=data.timss1[[1]]$TOTWGT,
    +bdat <- BIFIEsurvey::BIFIE.data( data.list=data.timss1, wgt=data.timss1[[1]]$TOTWGT,
                wgtrep=data.timssrep[, -1 ] )
     
     # Correlations splitted by gender
    -res1 <- BIFIEsurvey::BIFIE.correl( bdat, vars=c("lang", "books", "migrant" ),
    +res1 <- BIFIEsurvey::BIFIE.correl( bdat, vars=c("lang", "books", "migrant" ),
                   group="female", group_values=0:1 )
    -summary(res1)
    +summary(res1)
     
     # Correlations splitted by gender: no statistical inference (se=FALSE)
    -res1a <- BIFIEsurvey::BIFIE.correl( bdat, vars=c("lang", "books", "migrant" ),
    +res1a <- BIFIEsurvey::BIFIE.correl( bdat, vars=c("lang", "books", "migrant" ),
                   group="female", group_values=0:1, se=FALSE)
    -summary(res1a)
    -# }
    +summary(res1a)
    - +
    -

    Site built with pkgdown 1.3.0.

    +

    Site built with pkgdown 1.5.1.

    +
    + + diff --git a/docs/reference/BIFIE.crosstab.html b/docs/reference/BIFIE.crosstab.html index 4370062..59cc756 100644 --- a/docs/reference/BIFIE.crosstab.html +++ b/docs/reference/BIFIE.crosstab.html @@ -8,21 +8,29 @@ Cross Tabulation — BIFIE.crosstab • BIFIEsurvey + - + - + + - + + + + + - + + - + - - + + + @@ -30,10 +38,10 @@ - + - + @@ -47,9 +55,10 @@ + - +
    +
    @@ -105,23 +114,21 @@

    Cross Tabulation

    -

    Creates cross tabulations and computes some effect sizes.

    -
    BIFIE.crosstab( BIFIEobj, vars1, vars2, vars_values1=NULL, vars_values2=NULL,
          group=NULL, group_values=NULL, se=TRUE )
     
     # S3 method for BIFIE.crosstab
    -summary(object,digits=3,...)
    +summary(object,digits=3,...)
     
     # S3 method for BIFIE.crosstab
    -coef(object,...)
    +coef(object,...)
     
     # S3 method for BIFIE.crosstab
    -vcov(object,...)
    - +vcov(object,...) +

    Arguments

    @@ -168,11 +175,11 @@

    Arg

    - +

    Number of digits for rounding output

    ...

    Further arguments to be passed

    - +

    Value

    A list with following entries

    @@ -182,62 +189,54 @@

    Value

    Cramers \(V\), Goodman's gamma, the PRE lambda measure and Kruskals tau.

    output

    Extensive output with all replicated statistics

    -

    More values

    +
    ...

    More values

    -

    See also

    - - +

    Examples

    -
    # NOT RUN {
    -#############################################################################
    +    
    #############################################################################
     # EXAMPLE 1: Imputed TIMSS dataset
     #############################################################################
     
    -data(data.timss1)
    -data(data.timssrep)
    +data(data.timss1)
    +data(data.timssrep)
     
     # create BIFIE.dat object
    -bifieobj <- BIFIEsurvey::BIFIE.data( data.list=data.timss1, wgt=data.timss1[[1]]$TOTWGT,
    +bifieobj <- BIFIEsurvey::BIFIE.data( data.list=data.timss1, wgt=data.timss1[[1]]$TOTWGT,
                wgtrep=data.timssrep[, -1 ] )
     
     #--- Model 1: cross tabulation
    -res1 <- BIFIEsurvey::BIFIE.crosstab( bifieobj, vars1="migrant",
    +res1 <- BIFIEsurvey::BIFIE.crosstab( bifieobj, vars1="migrant",
                    vars2="books", group="female" )
    -summary(res1)
    -# }
    +summary(res1)
    - +
    -

    Site built with pkgdown 1.3.0.

    +

    Site built with pkgdown 1.5.1.

    +
    + + diff --git a/docs/reference/BIFIE.data.boot.html b/docs/reference/BIFIE.data.boot.html index e2b6837..48d2f57 100644 --- a/docs/reference/BIFIE.data.boot.html +++ b/docs/reference/BIFIE.data.boot.html @@ -8,21 +8,29 @@ Create <code>BIFIE.data</code> Object based on Bootstrap — BIFIE.data.boot • BIFIEsurvey + - + - + + - + + + + + - + + - + - - + + + @@ -30,11 +38,11 @@ - + - + @@ -48,9 +56,10 @@ + - +
    +
    @@ -106,15 +115,13 @@

    Create BIFIE.data Object based on Bootstrap

    -

    Creates a BIFIE.data object based on bootstrap designs. The sampling is done assuming independence of cases.

    -
    BIFIE.data.boot( data, wgt=NULL,  pv_vars=NULL,
              Nboot=500, seed=.Random.seed, cdata=FALSE)
    - +

    Arguments

    @@ -146,60 +153,54 @@

    Arg object should be compactly saved. The default is FALSE.

    - +

    Value

    Object of class BIFIEdata

    -

    See also

    -

    Examples

    -
    # NOT RUN {
    +    
    if (FALSE) {
     #############################################################################
     # EXAMPLE 1: Bootstrap TIMSS data set
     #############################################################################
    -data(data.timss1)
    +data(data.timss1)
     
     # bootstrap samples using weights
    -bifieobj1 <- BIFIEsurvey::BIFIE.data.boot( data.timss1, wgt="TOTWGT" )
    -summary(bifieobj1)
    +bifieobj1 <- BIFIEsurvey::BIFIE.data.boot( data.timss1, wgt="TOTWGT" )
    +summary(bifieobj1)
     
     # bootstrap samples without weights
    -bifieobj2 <- BIFIEsurvey::BIFIE.data.boot( data.timss1  )
    -summary(bifieobj2)
    -# }
    +bifieobj2 <- BIFIEsurvey::BIFIE.data.boot( data.timss1 ) +summary(bifieobj2) +}
    - +
    -

    Site built with pkgdown 1.3.0.

    +

    Site built with pkgdown 1.5.1.

    +
    + + diff --git a/docs/reference/BIFIE.data.html b/docs/reference/BIFIE.data.html index d6cbb8a..6999b13 100644 --- a/docs/reference/BIFIE.data.html +++ b/docs/reference/BIFIE.data.html @@ -8,21 +8,29 @@ Creates an Object of Class <code>BIFIEdata</code> — BIFIE.data • BIFIEsurvey + - + - + + - + + + + + - + + - + - - + + + @@ -30,13 +38,13 @@ - + - + @@ -50,9 +58,10 @@ + - +
    +
    @@ -108,23 +117,21 @@

    Creates an Object of Class BIFIEdata

    -

    This function creates an object of class BIFIEdata. Finite sampling correction of statistical inferences can be conducted by specifying appropriate input in the fayfac argument.

    -
    BIFIE.data(data.list, wgt=NULL, wgtrep=NULL, fayfac=1, pv_vars=NULL,
          pvpre=NULL, cdata=FALSE, NMI=FALSE)
     
     # S3 method for BIFIEdata
    -summary(object,...)
    +summary(object,...)
     
     # S3 method for BIFIEdata
    -print(x,...)
    - +print(x,...) +

    Arguments

    @@ -178,11 +185,11 @@

    Arg

    - +

    Object of class BIFIEdata

    ...

    Further arguments to be passed

    - +

    Value

    An object of class BIFIEdata saved in a non-compact @@ -210,7 +217,6 @@

    Value

    datalistM_imputed

    Data frame with imputed values (if cdata=TRUE)

    -

    See also

    See BIFIE.data.transform for data transformations on @@ -221,45 +227,44 @@

    See a objects see BIFIE.data.jack.

    See the BIFIEdata2svrepdesign function for converting BIFIEdata objects to objects used in the survey package.

    -

    Examples

    -
    # NOT RUN {
    -#############################################################################
    +    
    #############################################################################
     # EXAMPLE 1: Create BIFIEdata object with multiply-imputed TIMSS data
     #############################################################################
    -data(data.timss1)
    -data(data.timssrep)
    +data(data.timss1)
    +data(data.timssrep)
     
    -bdat <- BIFIEsurvey::BIFIE.data( data.list=data.timss1, wgt=data.timss1[[1]]$TOTWGT,
    +bdat <- BIFIEsurvey::BIFIE.data( data.list=data.timss1, wgt=data.timss1[[1]]$TOTWGT,
                 wgtrep=data.timssrep[, -1 ] )
    -summary(bdat)
    +summary(bdat)
     # create BIFIEdata object in a compact way
    -bdat2 <- BIFIEsurvey::BIFIE.data( data.list=data.timss1, wgt=data.timss1[[1]]$TOTWGT,
    +bdat2 <- BIFIEsurvey::BIFIE.data( data.list=data.timss1, wgt=data.timss1[[1]]$TOTWGT,
                 wgtrep=data.timssrep[, -1 ], cdata=TRUE)
    -summary(bdat2)
    +summary(bdat2)
     
    -# }# NOT RUN {
    +if (FALSE) {
     #############################################################################
     # EXAMPLE 2: Create BIFIEdata object with one dataset
     #############################################################################
    -data(data.timss2)
    +data(data.timss2)
     
     # use first dataset with missing data from data.timss2
    -bdat <- BIFIEsurvey::BIFIE.data( data.list=data.timss2[[1]], wgt=data.timss2[[1]]$TOTWGT)
    -# }# NOT RUN {
    +bdat <- BIFIEsurvey::BIFIE.data( data.list=data.timss2[[1]], wgt=data.timss2[[1]]$TOTWGT)
    +}
    +
     #############################################################################
     # EXAMPLE 3: BIFIEdata objects with finite sampling correction
     #############################################################################
     
    -data(data.timss1)
    -data(data.timssrep)
    +data(data.timss1)
    +data(data.timssrep)
     
     #-----
     # BIFIEdata object without finite sampling correction
    -bdat1 <- BIFIEsurvey::BIFIE.data( data.list=data.timss1, wgt=data.timss1[[1]]$TOTWGT,
    +bdat1 <- BIFIEsurvey::BIFIE.data( data.list=data.timss1, wgt=data.timss1[[1]]$TOTWGT,
                 wgtrep=data.timssrep[, -1 ] )
    -summary(bdat1)
    +summary(bdat1)
     
     #-----
     # generate BIFIEdata object with finite sampling correction by adjusting
    @@ -270,65 +275,61 @@ 

    Examp # set fayfac=.75 for the first 50 replication zones (25% of students in the # population were sampled) and fayfac=.20 for replication zones 51-75 # (meaning that 80% of students were sampled) -fayfac <- rep( fayfac0, bdat1$RR ) +fayfac <- rep( fayfac0, bdat1$RR ) fayfac[1:50] <- fayfac0 * .75 fayfac[51:75] <- fayfac0 * .20 # include this modified "fayfac" factor in bdat2 bdat2$fayfac <- fayfac -summary(bdat2) -summary(bdat1) +summary(bdat2) +summary(bdat1) #---- compare some univariate statistics # no finite sampling correction -res1 <- BIFIEsurvey::BIFIE.univar( bdat1, vars="ASMMAT") -summary(res1) +res1 <- BIFIEsurvey::BIFIE.univar( bdat1, vars="ASMMAT") +summary(res1) # finite sampling correction -res2 <- BIFIEsurvey::BIFIE.univar( bdat2, vars="ASMMAT") -summary(res2) +res2 <- BIFIEsurvey::BIFIE.univar( bdat2, vars="ASMMAT") +summary(res2) -# }# NOT RUN { +if (FALSE) { ############################################################################# # EXAMPLE 4: Create BIFIEdata object with nested multiply imputed dataset ############################################################################# -data(data.timss4) -data(data.timssrep) +data(data.timss4) +data(data.timssrep) # nested imputed dataset, save it in compact format -bdat <- BIFIEsurvey::BIFIE.data( data.list=data.timss4, +bdat <- BIFIEsurvey::BIFIE.data( data.list=data.timss4, wgt=data.timss4[[1]][[1]]$TOTWGT, wgtrep=data.timssrep[, -1 ], NMI=TRUE, cdata=TRUE ) -summary(bdat) -# }

    +summary(bdat) +}
    - +
    -

    Site built with pkgdown 1.3.0.

    +

    Site built with pkgdown 1.5.1.

    +
    + + diff --git a/docs/reference/BIFIE.data.jack.html b/docs/reference/BIFIE.data.jack.html index 30ec35d..207bf8b 100644 --- a/docs/reference/BIFIE.data.jack.html +++ b/docs/reference/BIFIE.data.jack.html @@ -8,21 +8,29 @@ Create <code>BIFIE.data</code> Object with Jackknife Zones — BIFIE.data.jack • BIFIEsurvey + - + - + + - + + + + + - + + - + - - + + + @@ -30,11 +38,11 @@ - + - + @@ -48,9 +56,10 @@ + - +
    +
    @@ -106,17 +115,15 @@

    Create BIFIE.data Object with Jackknife Zones

    -

    Creates a BIFIE.data object for designs with jackknife zones, especially for TIMSS/PIRLS and PISA studies.

    -
    BIFIE.data.jack(data, wgt=NULL, jktype="JK_TIMSS", pv_vars=NULL,
          jkzone=NULL, jkrep=NULL, jkfac=NULL, fayfac=NULL,
    -     wgtrep="W_FSTR", pvpre=paste0("PV",1:5), ngr=100,
    +     wgtrep="W_FSTR", pvpre=paste0("PV",1:5), ngr=100,
          seed=.Random.seed, cdata=FALSE)
    - +

    Arguments

    @@ -188,111 +195,104 @@

    Arg object should be compactly saved. The default is FALSE.

    - +

    Value

    Object of class BIFIEdata

    -

    See also

    -

    Examples

    -
    # NOT RUN {
    -#############################################################################
    +    
    #############################################################################
     # EXAMPLE 1: Convert TIMSS dataset to BIFIE.data object
     #############################################################################
     
    -data(data.timss3)
    +data(data.timss3)
     
     # define plausible values
    -pv_vars <- c("ASMMAT", "ASSSCI" )
    +pv_vars <- c("ASMMAT", "ASSSCI" )
     # create BIFIE.data objects -> 5 imputed datasets
    -bdat1 <- BIFIEsurvey::BIFIE.data.jack( data=data.timss3,  pv_vars=pv_vars,
    +bdat1 <- BIFIEsurvey::BIFIE.data.jack( data=data.timss3,  pv_vars=pv_vars,
                  jktype="JK_TIMSS"  )
    -summary(bdat1)
    +summary(bdat1)
     
     # create BIFIE.data objects -> all PVs are included in one dataset
    -bdat2 <- BIFIEsurvey::BIFIE.data.jack( data=data.timss3,  jktype="JK_TIMSS"  )
    -summary(bdat2)
    +bdat2 <- BIFIEsurvey::BIFIE.data.jack( data=data.timss3,  jktype="JK_TIMSS"  )
    +summary(bdat2)
     
     #############################################################################
     # EXAMPLE 2: Creation of Jackknife zones and replicate weights for data.test1
     #############################################################################
     
    -data(data.test1)
    +data(data.test1)
     
     # create jackknife zones based on random group creation
    -bdat1 <- BIFIEsurvey::BIFIE.data.jack( data=data.test1,  jktype="JK_RANDOM",
    +bdat1 <- BIFIEsurvey::BIFIE.data.jack( data=data.test1,  jktype="JK_RANDOM",
                         ngr=50 )
    -summary(bdat1)
    -stat1 <- BIFIEsurvey::BIFIE.univar( bdat1, vars="math",  group="stratum" )
    -summary(stat1)
    +summary(bdat1)
    +stat1 <- BIFIEsurvey::BIFIE.univar( bdat1, vars="math",  group="stratum" )
    +summary(stat1)
     
     # random creation of groups and inclusion of weights
    -bdat2 <- BIFIEsurvey::BIFIE.data.jack( data=data.test1,  jktype="JK_RANDOM",
    +bdat2 <- BIFIEsurvey::BIFIE.data.jack( data=data.test1,  jktype="JK_RANDOM",
                     ngr=75, seed=987, wgt="wgtstud")
    -summary(bdat2)
    -stat2 <- BIFIEsurvey::BIFIE.univar( bdat2, vars="math",  group="stratum" )
    -summary(stat2)
    +summary(bdat2)
    +stat2 <- BIFIEsurvey::BIFIE.univar( bdat2, vars="math",  group="stratum" )
    +summary(stat2)
     
     # using idclass as jackknife zones
    -bdat3 <- BIFIEsurvey::BIFIE.data.jack( data=data.test1,  jktype="JK_GROUP",
    +bdat3 <- BIFIEsurvey::BIFIE.data.jack( data=data.test1,  jktype="JK_GROUP",
                     jkzone="idclass", wgt="wgtstud")
    -summary(bdat3)
    -stat3 <- BIFIEsurvey::BIFIE.univar( bdat3, vars="math",  group="stratum" )
    -summary(stat3)
    +summary(bdat3)
    +stat3 <- BIFIEsurvey::BIFIE.univar( bdat3, vars="math",  group="stratum" )
    +summary(stat3)
     
     # create BIFIEdata object with a list of imputed datasets
    -dataList <- list( data.test1, data.test1, data.test1 )
    -bdat4 <- BIFIEsurvey::BIFIE.data.jack( data=dataList,  jktype="JK_GROUP",
    +dataList <- list( data.test1, data.test1, data.test1 )
    +bdat4 <- BIFIEsurvey::BIFIE.data.jack( data=dataList,  jktype="JK_GROUP",
                     jkzone="idclass", wgt="wgtstud")
    -summary(bdat4)
    +summary(bdat4)
     
    -# }# NOT RUN {
    +if (FALSE) {
     #############################################################################
     # EXAMPLE 3: Converting a PISA dataset into a BIFIEdata object
     #############################################################################
     
    -data(data.pisaNLD)
    +data(data.pisaNLD)
     
     # BIFIEdata with cdata=FALSE
    -bifieobj <- BIFIEsurvey::BIFIE.data.jack( data.pisaNLD, jktype="RW_PISA", cdata=FALSE)
    -summary(bifieobj)
    +bifieobj <- BIFIEsurvey::BIFIE.data.jack( data.pisaNLD, jktype="RW_PISA", cdata=FALSE)
    +summary(bifieobj)
     # BIFIEdata with cdata=TRUE
    -bifieobj1 <- BIFIEsurvey::BIFIE.data.jack( data.pisaNLD, jktype="RW_PISA", cdata=TRUE)
    -summary(bifieobj1)
    -# }
    +bifieobj1 <- BIFIEsurvey::BIFIE.data.jack( data.pisaNLD, jktype="RW_PISA", cdata=TRUE) +summary(bifieobj1) +}
    - +
    -

    Site built with pkgdown 1.3.0.

    +

    Site built with pkgdown 1.5.1.

    +
    + + diff --git a/docs/reference/BIFIE.data.select.html b/docs/reference/BIFIE.data.select.html index 0d69ca1..8e1410c 100644 --- a/docs/reference/BIFIE.data.select.html +++ b/docs/reference/BIFIE.data.select.html @@ -8,21 +8,29 @@ Selection of Variables and Imputed Datasets for Objects of Class <code>BIFIEdata</code> — BIFIEdata.select • BIFIEsurvey + - + - + + - + + + + + - + + - + - - + + + @@ -30,12 +38,12 @@ - + - + @@ -49,9 +57,10 @@ + - +
    +
    @@ -107,15 +116,13 @@

    Selection of Variables and Imputed Datasets for Objects of Class BIFIE

    -

    This function select variables and some (or all) imputed datasets of an object of class BIFIEdata and saves the resulting object also of class BIFIEdata.

    -
    BIFIEdata.select(bifieobj, varnames=NULL, impdata.index=NULL)
    - +

    Arguments

    @@ -132,72 +139,64 @@

    Arg

    Selected indices of imputed datasets

    - +

    Value

    An object of class BIFIEdata saved in a non-compact or compact way, see value cdata

    -

    See also

    See BIFIE.data for creating BIFIEdata objects.

    -

    Examples

    -
    # NOT RUN {
    -#############################################################################
    +    
    #############################################################################
     # EXAMPLE 1: Some manipulations of BIFIEdata objects created from data.timss1
     #############################################################################
    -data(data.timss1)
    -data(data.timssrep)
    +data(data.timss1)
    +data(data.timssrep)
     
     # create BIFIEdata
    -bdat1 <- BIFIEsurvey::BIFIE.data( data.list=data.timss1, wgt=data.timss1[[1]]$TOTWGT,
    +bdat1 <- BIFIEsurvey::BIFIE.data( data.list=data.timss1, wgt=data.timss1[[1]]$TOTWGT,
                 wgtrep=data.timssrep[, -1 ])
    -summary(bdat1)
    +summary(bdat1)
     
     # create BIFIEcdata object
    -bdat2 <- BIFIEsurvey::BIFIE.data( data.list=data.timss1, wgt=data.timss1[[1]]$TOTWGT,
    +bdat2 <- BIFIEsurvey::BIFIE.data( data.list=data.timss1, wgt=data.timss1[[1]]$TOTWGT,
                 wgtrep=data.timssrep[, -1 ], cdata=TRUE )
    -summary(bdat2)
    +summary(bdat2)
     
     # selection of variables for BIFIEdata object
    -bdat1a <- BIFIEsurvey::BIFIEdata.select( bdat1, varnames=bdat1$varnames[ 1:7 ] )
    +bdat1a <- BIFIEsurvey::BIFIEdata.select( bdat1, varnames=bdat1$varnames[ 1:7 ] )
     # selection of variables and 1st, 2nd and 4th imputed datasets of BIFIEcdata object
    -bdat2a <- BIFIEsurvey::BIFIEdata.select( bdat2, varnames=bdat2$varnames[ 1:7 ],
    -                impdata.index=c(1,2,4) )
    -summary(bdat1a)
    -summary(bdat2a)
    -# }
    +bdat2a <- BIFIEsurvey::BIFIEdata.select( bdat2, varnames=bdat2$varnames[ 1:7 ], + impdata.index=c(1,2,4) ) +summary(bdat1a) +summary(bdat2a)
    - +
    -

    Site built with pkgdown 1.3.0.

    +

    Site built with pkgdown 1.5.1.

    +
    + + diff --git a/docs/reference/BIFIE.data.transform.html b/docs/reference/BIFIE.data.transform.html index 72b6d2b..fec47d9 100644 --- a/docs/reference/BIFIE.data.transform.html +++ b/docs/reference/BIFIE.data.transform.html @@ -8,21 +8,29 @@ Data Transformation for <code>BIFIEdata</code> Objects — BIFIE.data.transform • BIFIEsurvey + - + - + + + + - + + + - + + - + - - + + + @@ -30,10 +38,10 @@ - + - + @@ -47,9 +55,10 @@ + - +
    +
    @@ -105,13 +114,11 @@

    Data Transformation for BIFIEdata Objects

    -

    Computes a data transformation for BIFIEdata objects.

    -
    BIFIE.data.transform( bifieobj, transform.formula, varnames.new=NULL )
    - +

    Arguments

    @@ -128,247 +135,243 @@

    Arg

    Optional vector of names for new defined variables.

    - +

    Value

    An object of class BIFIEdata. Additional values are

    varnames.added

    Added variables in data transformation

    varsindex.added

    Indices of added variables

    -

    Examples

    -
    # NOT RUN {
    -library(miceadds)
    +    
    library(miceadds)
     
     #############################################################################
     # EXAMPLE 1: Data transformations for TIMSS data
     #############################################################################
     
    -data(data.timss2)
    -data(data.timssrep)
    +data(data.timss2)
    +data(data.timssrep)
     # create BIFIEdata object
    -bifieobj1 <- BIFIEsurvey::BIFIE.data( data.timss2, wgt=data.timss2[[1]]$TOTWGT,
    +bifieobj1 <- BIFIEsurvey::BIFIE.data( data.timss2, wgt=data.timss2[[1]]$TOTWGT,
                 wgtrep=data.timssrep[,-1] )
     # create BIFIEdata object in compact way (cdata=TRUE)
    -bifieobj2 <- BIFIEsurvey::BIFIE.data( data.timss2, wgt=data.timss2[[1]]$TOTWGT,
    +bifieobj2 <- BIFIEsurvey::BIFIE.data( data.timss2, wgt=data.timss2[[1]]$TOTWGT,
                 wgtrep=data.timssrep[,-1], cdata=TRUE)
     
     #****************************
     #*** Transformation 1: Squared and cubic book variable
    -transform.formula <- ~ I( books^2 ) + I( books^3 )
    +transform.formula <- ~ I( books^2 ) + I( books^3 )
     # as.character(transform.formula)
    -bifieobj <- BIFIEsurvey::BIFIE.data.transform( bifieobj1,
    +bifieobj <- BIFIEsurvey::BIFIE.data.transform( bifieobj1,
                       transform.formula=transform.formula)
     bifieobj$variables
     # rename added variables
    -bifieobj$varnames[ bifieobj$varsindex.added ] <- c("books_sq", "books_cub")
    +bifieobj$varnames[ bifieobj$varsindex.added ] <- c("books_sq", "books_cub")
     
     # check descriptive statistics
    -res1 <- BIFIEsurvey::BIFIE.univar( bifieobj, vars=c("books_sq", "books_cub" ) )
    -summary(res1)
    +res1 <- BIFIEsurvey::BIFIE.univar( bifieobj, vars=c("books_sq", "books_cub" ) )
    +summary(res1)
     
    -# }# NOT RUN {
    +if (FALSE) {
     #****************************
     #*** Transformation 2: Create dummy variables for variable book
    -transform.formula <- ~ as.factor(books)
    -bifieobj <- BIFIEsurvey::BIFIE.data.transform( bifieobj,
    +transform.formula <- ~ as.factor(books)
    +bifieobj <- BIFIEsurvey::BIFIE.data.transform( bifieobj,
                         transform.formula=transform.formula )
     ##   Included 5 variables: as.factor(books)1 as.factor(books)2 as.factor(books)3
     ##        as.factor(books)4 as.factor(books)5
    -bifieobj$varnames[ bifieobj$varsindex.added ] <- paste0("books_D", 1:5)
    +bifieobj$varnames[ bifieobj$varsindex.added ] <- paste0("books_D", 1:5)
     
     #****************************
     #*** Transformation 3: Discretized mathematics score
    -hi3a <- BIFIEsurvey::BIFIE.hist( bifieobj, vars="ASMMAT" )
    -plot(hi3a)
    -transform.formula <- ~ I( as.numeric(cut( ASMMAT, breaks=seq(200,800,100) )) )
    -bifieobj <- BIFIEsurvey::BIFIE.data.transform( bifieobj,
    +hi3a <- BIFIEsurvey::BIFIE.hist( bifieobj, vars="ASMMAT" )
    +plot(hi3a)
    +transform.formula <- ~ I( as.numeric(cut( ASMMAT, breaks=seq(200,800,100) )) )
    +bifieobj <- BIFIEsurvey::BIFIE.data.transform( bifieobj,
                      transform.formula=transform.formula, varnames.new="ASMMAT_discret")
    -hi3b <- BIFIEsurvey::BIFIE.hist( bifieobj, vars="ASMMAT_discret", breaks=1:7 )
    -plot(hi3b)
    +hi3b <- BIFIEsurvey::BIFIE.hist( bifieobj, vars="ASMMAT_discret", breaks=1:7 )
    +plot(hi3b)
     # check frequencies
    -fr3b <- BIFIEsurvey::BIFIE.freq( bifieobj, vars="ASMMAT_discret", se=FALSE )
    -summary(fr3b)
    +fr3b <- BIFIEsurvey::BIFIE.freq( bifieobj, vars="ASMMAT_discret", se=FALSE )
    +summary(fr3b)
     
     #****************************
     #*** Transformation 4: include standardization variables for book variable
     
     # start with testing the transformation function on a single dataset
     dat1 <- bifieobj$dat1
    -stats::weighted.mean( dat1[,"books"], dat1[,"TOTWGT"], na.rm=TRUE)
    -sqrt( Hmisc::wtd.var( dat1[,"books"], dat1[,"TOTWGT"], na.rm=TRUE) )
    +stats::weighted.mean( dat1[,"books"], dat1[,"TOTWGT"], na.rm=TRUE)
    +sqrt( Hmisc::wtd.var( dat1[,"books"], dat1[,"TOTWGT"], na.rm=TRUE) )
     # z standardization
    -transform.formula <- ~ I( ( books - weighted.mean( books, TOTWGT, na.rm=TRUE) )/
    -                                sqrt( Hmisc::wtd.var( books, TOTWGT, na.rm=TRUE) ))
    -bifieobj <- BIFIEsurvey::BIFIE.data.transform( bifieobj,
    +transform.formula <- ~ I( ( books - weighted.mean( books, TOTWGT, na.rm=TRUE) )/
    +                                sqrt( Hmisc::wtd.var( books, TOTWGT, na.rm=TRUE) ))
    +bifieobj <- BIFIEsurvey::BIFIE.data.transform( bifieobj,
                    transform.formula=transform.formula, varnames.new="z_books" )
     # standardize variable books with M=500 and SD=100
    -transform.formula <- ~ I(
    -        500 + 100*( books - stats::weighted.mean( books, w=TOTWGT, na.rm=TRUE) ) /
    -              sqrt( Hmisc::wtd.var( books, weights=TOTWGT, na.rm=TRUE) )  )
    -bifieobj <- BIFIEsurvey::BIFIE.data.transform( bifieobj,
    +transform.formula <- ~ I(
    +        500 + 100*( books - stats::weighted.mean( books, w=TOTWGT, na.rm=TRUE) ) /
    +              sqrt( Hmisc::wtd.var( books, weights=TOTWGT, na.rm=TRUE) )  )
    +bifieobj <- BIFIEsurvey::BIFIE.data.transform( bifieobj,
                  transform.formula=transform.formula, varnames.new="z500_books" )
     
     # standardize variable books with respect to M and SD of ALL imputed datasets
    -res <- BIFIEsurvey::BIFIE.univar( bifieobj, vars="books" )
    -summary(res)
    +res <- BIFIEsurvey::BIFIE.univar( bifieobj, vars="books" )
    +summary(res)
     ##       var  Nweight Ncases     M M_SE M_fmi M_VarMI M_VarRep    SD SD_SE SD_fmi
     ##   1 books 76588.72   4554 2.945 0.04     0       0    0.002 1.146 0.015      0
    -M <- round(res$output$mean1,5)
    -SD <- round(res$output$sd1,5)
    -transform.formula <- paste0( " ~ I( ( books - ",  M, " ) / ", SD, ")"  )
    +M <- round(res$output$mean1,5)
    +SD <- round(res$output$sd1,5)
    +transform.formula <- paste0( " ~ I( ( books - ",  M, " ) / ", SD, ")"  )
     ##   > transform.formula
     ##   [1] " ~ I( ( books - 2.94496 ) / 1.14609)"
    -bifieobj <- BIFIEsurvey::BIFIE.data.transform( bifieobj,
    -                 transform.formula=stats::as.formula(transform.formula),
    +bifieobj <- BIFIEsurvey::BIFIE.data.transform( bifieobj,
    +                 transform.formula=stats::as.formula(transform.formula),
                      varnames.new="zall_books" )
     
     # check statistics
    -res4 <- BIFIEsurvey::BIFIE.univar( bifieobj,
    -              vars=c("z_books", "z500_books", "zall_books") )
    -summary(res4)
    +res4 <- BIFIEsurvey::BIFIE.univar( bifieobj,
    +              vars=c("z_books", "z500_books", "zall_books") )
    +summary(res4)
     
     #****************************
     #*** Transformation 5: include rank transformation for variable ASMMAT
     
     # calculate percentage ranks using wtd.rank function from Hmisc package
     dat1 <- bifieobj$dat1
    -100 * Hmisc::wtd.rank( dat1[,"ASMMAT"], w=dat1[,"TOTWGT"] ) / sum( dat1[,"TOTWGT"] )
    +100 * Hmisc::wtd.rank( dat1[,"ASMMAT"], w=dat1[,"TOTWGT"] ) / sum( dat1[,"TOTWGT"] )
     # define an auxiliary function for calculating percentage ranks
     wtd.percrank <- function( x, w ){
    -    100 * Hmisc::wtd.rank( x, w, na.rm=TRUE ) / sum( w, na.rm=TRUE )
    +    100 * Hmisc::wtd.rank( x, w, na.rm=TRUE ) / sum( w, na.rm=TRUE )
     }
     wtd.percrank( dat1[,"ASMMAT"], dat1[,"TOTWGT"] )
     # define transformation formula
    -transform.formula <- ~ I( wtd.percrank( ASMMAT, TOTWGT ) )
    +transform.formula <- ~ I( wtd.percrank( ASMMAT, TOTWGT ) )
     # add ranks to BIFIEdata object
    -bifieobj <- BIFIEsurvey::BIFIE.data.transform( bifieobj,
    +bifieobj <- BIFIEsurvey::BIFIE.data.transform( bifieobj,
                    transform.formula=transform.formula,  varnames.new="ASMMAT_rk")
     # check statistic
    -res5 <- BIFIEsurvey::BIFIE.univar( bifieobj, vars=c("ASMMAT_rk" ) )
    -summary(res5)
    +res5 <- BIFIEsurvey::BIFIE.univar( bifieobj, vars=c("ASMMAT_rk" ) )
    +summary(res5)
     
     #****************************
     #*** Transformation 6: recode variable books
     
    -library(car)
    +library(car)
     # recode variable books according to "1,2=0, 3,4=1, 5=2"
     dat1 <- bifieobj$dat1
     # use Recode function from car package
    -car::Recode( dat1[,"books"], "1:2='0'; c(3,4)='1';5='2'")
    +car::Recode( dat1[,"books"], "1:2='0'; c(3,4)='1';5='2'")
     # define transformation formula
    -transform.formula <- ~ I( car::Recode( books, "1:2='0'; c(3,4)='1';5='2'") )
    -bifieobj <- BIFIEsurvey::BIFIE.data.transform( bifieobj,
    +transform.formula <- ~ I( car::Recode( books, "1:2='0'; c(3,4)='1';5='2'") )
    +bifieobj <- BIFIEsurvey::BIFIE.data.transform( bifieobj,
                    transform.formula=transform.formula,  varnames.new="book_rec" )
    -res6 <- BIFIEsurvey::BIFIE.freq( bifieobj, vars=c("book_rec" ) )
    -summary(res6)
    +res6 <- BIFIEsurvey::BIFIE.freq( bifieobj, vars=c("book_rec" ) )
    +summary(res6)
     
     #****************************
     #*** Transformation 7: include some variables aggregated to the school level
     
    -dat1 <- as.data.frame(bifieobj$dat1)
    +dat1 <- as.data.frame(bifieobj$dat1)
     # at first, create school ID in the dataset by transforming the student ID
    -dat1$idschool <- as.numeric(substring( dat1$IDSTUD, 1, 5 ))
    -transform.formula <- ~ I( as.numeric( substring( IDSTUD, 1, 5 ) ) )
    -bifieobj <- BIFIEsurvey::BIFIE.data.transform( bifieobj,
    +dat1$idschool <- as.numeric(substring( dat1$IDSTUD, 1, 5 ))
    +transform.formula <- ~ I( as.numeric( substring( IDSTUD, 1, 5 ) ) )
    +bifieobj <- BIFIEsurvey::BIFIE.data.transform( bifieobj,
                    transform.formula=transform.formula, varnames.new="idschool" )
     
     #*** test function for a single dataset bifieobj$dat1
    -dat1 <- as.data.frame(bifieobj$dat1)
    -gm <- miceadds::GroupMean( data=dat1$ASMMAT, group=dat1$idschool, extend=TRUE)[,2]
    +dat1 <- as.data.frame(bifieobj$dat1)
    +gm <- miceadds::GroupMean( data=dat1$ASMMAT, group=dat1$idschool, extend=TRUE)[,2]
     
     # add school mean ASMMAT
    -tformula <- ~ I( miceadds::GroupMean( ASMMAT, group=idschool, extend=TRUE)[,2] )
    -bifieobj <- BIFIEsurvey::BIFIE.data.transform( bifieobj, transform.formula=tformula,
    +tformula <- ~ I( miceadds::GroupMean( ASMMAT, group=idschool, extend=TRUE)[,2] )
    +bifieobj <- BIFIEsurvey::BIFIE.data.transform( bifieobj, transform.formula=tformula,
                     varnames.new="M_ASMMAT" )
     # add within group centered mathematics values of ASMMAT
    -bifieobj <- BIFIEsurvey::BIFIE.data.transform( bifieobj,
    -                transform.formula=~ 0 + I( ASMMAT - M_ASMMAT ),
    +bifieobj <- BIFIEsurvey::BIFIE.data.transform( bifieobj,
    +                transform.formula=~ 0 + I( ASMMAT - M_ASMMAT ),
                     varnames.new="WC_ASMMAT" )
     
     # add school mean books
    -bifieobj <- BIFIEsurvey::BIFIE.data.transform( bifieobj,
    -                transform.formula=~ 0 + I( add.groupmean( books, idschool ) ),
    +bifieobj <- BIFIEsurvey::BIFIE.data.transform( bifieobj,
    +                transform.formula=~ 0 + I( add.groupmean( books, idschool ) ),
                     varnames.new="M_books" )
     
     #****************************
     #*** Transformation 8: include fitted values and residuals from a linear model
     # create new BIFIEdata object
    -data(data.timss1)
    -bifieobj3 <- BIFIEsurvey::BIFIE.data( data.timss1, wgt=data.timss1[[1]]$TOTWGT,
    +data(data.timss1)
    +bifieobj3 <- BIFIEsurvey::BIFIE.data( data.timss1, wgt=data.timss1[[1]]$TOTWGT,
                 wgtrep=data.timssrep[,-1] )
     
     # specify transformation
    -transform.formula <- ~ I( fitted( stats::lm( ASMMAT ~ migrant + female ) ) ) +
    -                             I( residuals( stats::lm( ASMMAT ~ migrant + female ) ) )
    +transform.formula <- ~ I( fitted( stats::lm( ASMMAT ~ migrant + female ) ) ) +
    +                             I( residuals( stats::lm( ASMMAT ~ migrant + female ) ) )
       # Note that lm omits cases in regression by listwise deletion.
     # add fitted values and residual to BIFIEdata object
    -bifieobj <- BIFIEsurvey::BIFIE.data.transform( bifieobj3,
    +bifieobj <- BIFIEsurvey::BIFIE.data.transform( bifieobj3,
                       transform.formula=transform.formula )
    -bifieobj$varnames[ bifieobj$varsindex.added ] <- c("math_fitted1", "math_resid1")
    +bifieobj$varnames[ bifieobj$varsindex.added ] <- c("math_fitted1", "math_resid1")
     
     #****************************
     #*** Transformation 9: Including principal component scores in BIFIEdata object
     
     # define auxiliary function for extracting PCA scores
     BIFIE.princomp <- function( formula, Ncomp ){
    -    X <- stats::princomp( formula, cor=TRUE)
    +    X <- stats::princomp( formula, cor=TRUE)
         Xp <- X$scores[, 1:Ncomp ]
    -    return(Xp)
    +    return(Xp)
     }
     # define transformation formula
    -transform.formula <- ~ I( BIFIE.princomp( ~ migrant + female + books + lang + ASMMAT, 3 ))
    +transform.formula <- ~ I( BIFIE.princomp( ~ migrant + female + books + lang + ASMMAT, 3 ))
     # apply transformation
    -bifieobj <- BIFIEsurvey::BIFIE.data.transform( bifieobj3,
    +bifieobj <- BIFIEsurvey::BIFIE.data.transform( bifieobj3,
                     transform.formula=transform.formula )
    -bifieobj$varnames[ bifieobj$varsindex.added ] <- c("pca_sc1", "pca_sc2","pca_sc3")
    +bifieobj$varnames[ bifieobj$varsindex.added ] <- c("pca_sc1", "pca_sc2","pca_sc3")
     # check descriptive statistics
    -res9 <- BIFIEsurvey::BIFIE.univar( bifieobj, vars="pca_sc1", se=FALSE)
    -summary(res9)
    +res9 <- BIFIEsurvey::BIFIE.univar( bifieobj, vars="pca_sc1", se=FALSE)
    +summary(res9)
     res9$output$mean1M
     
     # The transformation formula can also be conveniently generated by string operations
    -vars <- c("migrant", "female", "books", "lang" )
    -transform.formula2 <- as.formula( paste0( "~ 0 + I ( BIFIE.princomp( ~ ",
    -       paste0( vars, collapse="+" ),  ", 3 ) )") )
    +vars <- c("migrant", "female", "books", "lang" )
    +transform.formula2 <- as.formula( paste0( "~ 0 + I ( BIFIE.princomp( ~ ",
    +       paste0( vars, collapse="+" ),  ", 3 ) )") )
       ##   > transform.formula2
       ##   ~ I(BIFIE.princomp(~migrant + female + books + lang, 3))
     
     #****************************
     #*** Transformation 10: Overwriting variables books and migrant
    -bifieobj4 <-  BIFIEsurvey::BIFIE.data.transform( bifieobj3,
    -                  transform.formula=~ I( 1*(books >=1 ) ) + I(2*migrant),
    -                  varnames.new=c("books","migrant") )
    -summary(bifieobj4)
    -# }
    +bifieobj4 <- BIFIEsurvey::BIFIE.data.transform( bifieobj3, + transform.formula=~ I( 1*(books >=1 ) ) + I(2*migrant), + varnames.new=c("books","migrant") ) +summary(bifieobj4) +}
    - +
    -

    Site built with pkgdown 1.3.0.

    +

    Site built with pkgdown 1.5.1.

    +
    + + diff --git a/docs/reference/BIFIE.derivedParameters.html b/docs/reference/BIFIE.derivedParameters.html index 1533950..5718703 100644 --- a/docs/reference/BIFIE.derivedParameters.html +++ b/docs/reference/BIFIE.derivedParameters.html @@ -8,21 +8,29 @@ Statistical Inference for Derived Parameters — BIFIE.derivedParameters • BIFIEsurvey + - + - + + - + + + + + - + + - + - - + + + @@ -30,13 +38,13 @@ - + - + @@ -50,9 +58,10 @@ + - +
    +
    @@ -108,25 +117,23 @@

    Statistical Inference for Derived Parameters

    -

    This function performs statistical for derived parameters for objects of classes BIFIE.by, BIFIE.correl, BIFIE.crosstab, BIFIE.freq, BIFIE.linreg, BIFIE.logistreg and BIFIE.univar.

    -
    BIFIE.derivedParameters( BIFIE.method, derived.parameters, type=NULL)
     
     # S3 method for BIFIE.derivedParameters
    -summary(object,digits=4,...)
    +summary(object,digits=4,...)
     
     # S3 method for BIFIE.derivedParameters
    -coef(object,...)
    +coef(object,...)
     
     # S3 method for BIFIE.derivedParameters
    -vcov(object,...)
    - +vcov(object,...) +

    Arguments

    @@ -157,16 +164,15 @@

    Arg

    - +

    Number of digits for rounding decimals in output

    ...

    Further arguments to be passed

    - +

    Details

    The distribution of derived parameters is derived by the direct calculation using original resampled parameters.

    -

    Value

    A list with following entries

    @@ -175,88 +181,78 @@

    Value

    vcov

    Covariance matrix of derived parameters

    parnames

    Parameter names

    res_wald

    Output of Wald test (global test regarding all parameters)

    -

    More values

    +
    ...

    More values

    -

    See also

    See also BIFIE.waldtest for multi-parameter tests.

    -

    See car::deltaMethod for the Delta method assuming that the multivariate +

    See car::deltaMethod for the Delta method assuming that the multivariate distribution of the parameters is asymptotically normal.

    -

    Examples

    -
    # NOT RUN {
    -#############################################################################
    +    
    #############################################################################
     # EXAMPLE 1: Imputed TIMSS dataset
     #            Inference for correlations and derived parameters
     #############################################################################
     
    -data(data.timss1)
    -data(data.timssrep)
    +data(data.timss1)
    +data(data.timssrep)
     
     # create BIFIE.dat object
    -bdat <- BIFIEsurvey::BIFIE.data( data.list=data.timss1, wgt=data.timss1[[1]]$TOTWGT,
    +bdat <- BIFIEsurvey::BIFIE.data( data.list=data.timss1, wgt=data.timss1[[1]]$TOTWGT,
                wgtrep=data.timssrep[, -1 ] )
     
     # compute correlations
    -res1 <- BIFIEsurvey::BIFIE.correl( bdat,
    -            vars=c("ASSSCI", "ASMMAT", "books", "migrant" )  )
    -summary(res1)
    +res1 <- BIFIEsurvey::BIFIE.correl( bdat,
    +            vars=c("ASSSCI", "ASMMAT", "books", "migrant" )  )
    +summary(res1)
     res1$parnames
       ##    [1] "ASSSCI_ASSSCI"   "ASSSCI_ASMMAT"   "ASSSCI_books"    "ASSSCI_migrant"
       ##    [5] "ASMMAT_ASMMAT"   "ASMMAT_books"    "ASMMAT_migrant"  "books_books"
       ##    [9] "books_migrant"   "migrant_migrant"
     
     # define four derived parameters
    -derived.parameters <- list(
    +derived.parameters <- list(
             # squared correlation of science and mathematics
    -        "R2_sci_mat"=~ I( 100* ASSSCI_ASMMAT^2  ),
    +        "R2_sci_mat"=~ I( 100* ASSSCI_ASMMAT^2  ),
             # partial correlation of science and mathematics controlling for books
    -        "parcorr_sci_mat"=~ I( ( ASSSCI_ASMMAT - ASSSCI_books * ASMMAT_books ) /
    -                            sqrt(( 1 - ASSSCI_books^2 ) * ( 1-ASMMAT_books^2 ) ) ),
    +        "parcorr_sci_mat"=~ I( ( ASSSCI_ASMMAT - ASSSCI_books * ASMMAT_books ) /
    +                            sqrt(( 1 - ASSSCI_books^2 ) * ( 1-ASMMAT_books^2 ) ) ),
             # original correlation science and mathematics (already contained in res1)
    -        "cor_sci_mat"=~ I(ASSSCI_ASMMAT),
    +        "cor_sci_mat"=~ I(ASSSCI_ASMMAT),
             # original correlation books and migrant
    -        "cor_book_migra"=~ I(books_migrant)
    +        "cor_book_migra"=~ I(books_migrant)
             )
     
     # statistical inference for derived parameters
    -res2 <- BIFIEsurvey::BIFIE.derivedParameters( res1, derived.parameters )
    -summary(res2)
    -# }
    +res2 <- BIFIEsurvey::BIFIE.derivedParameters( res1, derived.parameters ) +summary(res2)
    - +
    -

    Site built with pkgdown 1.3.0.

    +

    Site built with pkgdown 1.5.1.

    +
    + + diff --git a/docs/reference/BIFIE.ecdf.html b/docs/reference/BIFIE.ecdf.html index 78a19a5..6bbc5c5 100644 --- a/docs/reference/BIFIE.ecdf.html +++ b/docs/reference/BIFIE.ecdf.html @@ -8,21 +8,29 @@ Empirical Distribution Function and Quantiles — BIFIE.ecdf • BIFIEsurvey + - + - + + - + + + + + - + + - + - - + + + @@ -30,14 +38,14 @@ - + - + @@ -51,9 +59,10 @@ + - +
    +
    @@ -109,20 +118,18 @@

    Empirical Distribution Function and Quantiles

    -

    Computes an empirical distribution function (and quantiles). If only some quantiles should be calculated, then an appropriate vector of breaks (which are quantiles) must be specified. Statistical inference is not conducted for this method.

    -
    BIFIE.ecdf( BIFIEobj, vars, breaks=NULL, quanttype=1, group=NULL, group_values=NULL )
     
     # S3 method for BIFIE.ecdf
    -summary(object,digits=4,...)
    - +summary(object,digits=4,...) +

    Arguments

    @@ -142,7 +149,7 @@

    Arg

    @@ -163,11 +170,11 @@

    Arg

    - +
    quanttype

    Type of calculation for quantiles. In case of quanttype=1, a linear interpolation is used (which is type='i/n' in -Hmisc::wtd.quantile), +Hmisc::wtd.quantile), while for quanttype=2 no interpolation is used.

    Number of digits for rounding output

    ...

    Further arguments to be passed

    - +

    Value

    A list with following entries

    @@ -176,70 +183,62 @@

    Value

    stat

    Data frame with empirical distribution function stacked with respect to variables, groups and group values

    output

    More extensive output

    -

    More values

    +
    ...

    More values

    -

    See also

    Hmisc::wtd.ecdf, -Hmisc::wtd.quantile

    - +Hmisc::wtd.quantile

    Examples

    -
    # NOT RUN {
    -#############################################################################
    +    
    #############################################################################
     # EXAMPLE 1: Imputed TIMSS dataset
     #############################################################################
     
    -data(data.timss1)
    -data(data.timssrep)
    +data(data.timss1)
    +data(data.timssrep)
     
     # create BIFIE.dat object
    -bifieobj <- BIFIEsurvey::BIFIE.data( data.list=data.timss1, wgt=data.timss1[[1]]$TOTWGT,
    +bifieobj <- BIFIEsurvey::BIFIE.data( data.list=data.timss1, wgt=data.timss1[[1]]$TOTWGT,
                wgtrep=data.timssrep[, -1 ] )
     
     # ecdf
    -vars <- c( "ASMMAT", "books")
    +vars <- c( "ASMMAT", "books")
     group <- "female" ; group_values <- 0:1
     # quantile type 1
    -res1 <- BIFIEsurvey::BIFIE.ecdf( bifieobj,  vars=vars, group=group )
    -summary(res1)
    -res2 <- BIFIEsurvey::BIFIE.ecdf( bifieobj,  vars=vars, group=group, quanttype=2)
    +res1 <- BIFIEsurvey::BIFIE.ecdf( bifieobj,  vars=vars, group=group )
    +summary(res1)
    +res2 <- BIFIEsurvey::BIFIE.ecdf( bifieobj,  vars=vars, group=group, quanttype=2)
     # plot distribution function
     ecdf1 <- res1$ecdf
    -plot( ecdf1$ASMMAT_female0, ecdf1$yval, type="l")
    -plot( res2$ecdf$ASMMAT_female0, ecdf1$yval, type="l", lty=2)
    -plot( ecdf1$books_female0, ecdf1$yval, type="l", col="blue")
    -# }
    +plot( ecdf1$ASMMAT_female0, ecdf1$yval, type="l") +plot( res2$ecdf$ASMMAT_female0, ecdf1$yval, type="l", lty=2) +plot( ecdf1$books_female0, ecdf1$yval, type="l", col="blue")
    - +
    -

    Site built with pkgdown 1.3.0.

    +

    Site built with pkgdown 1.5.1.

    +
    + + diff --git a/docs/reference/BIFIE.freq.html b/docs/reference/BIFIE.freq.html index 19aca69..cfe697d 100644 --- a/docs/reference/BIFIE.freq.html +++ b/docs/reference/BIFIE.freq.html @@ -8,21 +8,29 @@ Frequency Statistics — BIFIE.freq • BIFIEsurvey + - + - + + - + + + + + - + + - + - - + + + @@ -30,10 +38,10 @@ - + - + @@ -47,9 +55,10 @@ + - +
    +
    @@ -105,22 +114,20 @@

    Frequency Statistics

    -

    Computes absolute and relative frequencies.

    -
    BIFIE.freq(BIFIEobj, vars, group=NULL, group_values=NULL, se=TRUE)
     
     # S3 method for BIFIE.freq
    -summary(object,digits=3,...)
    +summary(object,digits=3,...)
     
     # S3 method for BIFIE.freq
    -coef(object,...)
    +coef(object,...)
     
     # S3 method for BIFIE.freq
    -vcov(object,...)
    - +vcov(object,...) +

    Arguments

    @@ -155,82 +162,74 @@

    Arg

    - +

    Number of digits for rounding output

    ...

    Further arguments to be passed

    - +

    Value

    A list with following entries

    stat

    Data frame with frequency statistics

    output

    Extensive output with all replicated statistics

    -

    More values

    +
    ...

    More values

    -

    See also

    - - +

    survey::svytable, +intsvy::timss.table, +Hmisc::wtd.table

    Examples

    -
    # NOT RUN {
    -#############################################################################
    +    
    #############################################################################
     # EXAMPLE 1: Imputed TIMSS dataset
     #############################################################################
     
    -data(data.timss1)
    -data(data.timssrep)
    +data(data.timss1)
    +data(data.timssrep)
     
     # create BIFIE.dat object
    -bdat <- BIFIEsurvey::BIFIE.data( data.list=data.timss1, wgt=data.timss1[[1]]$TOTWGT,
    +bdat <- BIFIEsurvey::BIFIE.data( data.list=data.timss1, wgt=data.timss1[[1]]$TOTWGT,
                wgtrep=data.timssrep[, -1 ] )
     
     # Frequencies for three variables
    -res1 <- BIFIEsurvey::BIFIE.freq( bdat, vars=c("lang", "books", "migrant" )  )
    -summary(res1)
    +res1 <- BIFIEsurvey::BIFIE.freq( bdat, vars=c("lang", "books", "migrant" )  )
    +summary(res1)
     
     # Frequencies splitted by gender
    -res2 <- BIFIEsurvey::BIFIE.freq( bdat, vars=c("lang", "books", "migrant" ),
    +res2 <- BIFIEsurvey::BIFIE.freq( bdat, vars=c("lang", "books", "migrant" ),
                   group="female", group_values=0:1 )
    -summary(res2)
    +summary(res2)
     
     # Frequencies splitted by gender and likesc
    -res3 <- BIFIEsurvey::BIFIE.freq( bdat, vars=c("lang", "books", "migrant" ),
    -              group=c("likesc","female")  )
    -summary(res3)
    -# }
    +res3 <- BIFIEsurvey::BIFIE.freq( bdat, vars=c("lang", "books", "migrant" ), + group=c("likesc","female") ) +summary(res3)
    - +
    -

    Site built with pkgdown 1.3.0.

    +

    Site built with pkgdown 1.5.1.

    +
    + + diff --git a/docs/reference/BIFIE.hist.html b/docs/reference/BIFIE.hist.html index 8cdf8ec..f735b85 100644 --- a/docs/reference/BIFIE.hist.html +++ b/docs/reference/BIFIE.hist.html @@ -8,21 +8,29 @@ Histogram — BIFIE.hist • BIFIEsurvey + - + - + + - + + + + + - + + - + - - + + + @@ -30,12 +38,12 @@ - + - + @@ -49,9 +57,10 @@ + - +
    +
    @@ -107,21 +116,19 @@

    Histogram

    -

    Computes a histogram with same output as in -graphics::hist. +graphics::hist. Statistical inference is not conducted for this method.

    -
    BIFIE.hist( BIFIEobj, vars, breaks=NULL, group=NULL, group_values=NULL  )
     
     # S3 method for BIFIE.hist
    -summary(object,...)
    +summary(object,...)
     
     # S3 method for BIFIE.hist
    -plot(x,ask=TRUE,...)
    - +plot(x,ask=TRUE,...) +

    Arguments

    @@ -159,78 +166,70 @@

    Arg

    - +

    Optional logical whether it should be asked for new plots.

    ...

    Further arguments to be passed

    - +

    Value

    A list with following entries

    histobj

    List with objects of class histogram

    output

    More extensive output

    -

    More values

    +
    ...

    More values

    -

    See also

    - - +

    Examples

    -
    # NOT RUN {
    -#############################################################################
    +    
    #############################################################################
     # EXAMPLE 1: Imputed TIMSS dataset
     #############################################################################
     
    -data(data.timss1)
    -data(data.timssrep)
    +data(data.timss1)
    +data(data.timssrep)
     
     # create BIFIE.dat object
    -bifieobj <- BIFIEsurvey::BIFIE.data( data.list=data.timss1, wgt=data.timss1[[1]]$TOTWGT,
    +bifieobj <- BIFIEsurvey::BIFIE.data( data.list=data.timss1, wgt=data.timss1[[1]]$TOTWGT,
                wgtrep=data.timssrep[, -1 ] )
     
     # histogram
    -res1 <- BIFIEsurvey::BIFIE.hist( bifieobj, vars="ASMMAT", group="female" )
    +res1 <- BIFIEsurvey::BIFIE.hist( bifieobj, vars="ASMMAT", group="female" )
     # plot histogram for first group (female=0)
    -plot( res1$histobj$ASMMAT_female0, col="lightblue")
    +plot( res1$histobj$ASMMAT_female0, col="lightblue")
     # plot both histograms after each other
    -plot( res1 )
    +plot( res1 )
     
     # user-defined vector of breaks
    -res2 <- BIFIEsurvey::BIFIE.hist( bifieobj, vars="ASMMAT",
    -              breaks=seq(0,900,10), group="female" )
    -plot( res2, col="orange")
    -# }
    +res2 <- BIFIEsurvey::BIFIE.hist( bifieobj, vars="ASMMAT", + breaks=seq(0,900,10), group="female" ) +plot( res2, col="orange")
    - +
    -

    Site built with pkgdown 1.3.0.

    +

    Site built with pkgdown 1.5.1.

    +
    + + diff --git a/docs/reference/BIFIE.lavaan.survey.html b/docs/reference/BIFIE.lavaan.survey.html index dca5979..926f659 100644 --- a/docs/reference/BIFIE.lavaan.survey.html +++ b/docs/reference/BIFIE.lavaan.survey.html @@ -8,21 +8,29 @@ Fitting a Model in <span class="pkg">lavaan</span> or in <span class="pkg">survey</span> — BIFIE.lavaan.survey • BIFIEsurvey + - + - + + - + + + + + - + + - + - - + + + @@ -30,13 +38,13 @@ -lavaan or in survey — BIFIE.lavaan.survey" /> +lavaan or in survey — BIFIE.lavaan.survey" /> - + @@ -50,9 +58,10 @@ + - +
    +
    @@ -108,37 +117,35 @@

    Fitting a Model in lavaan or in s

    -

    The function BIFIE.lavaan.survey fits a structural equation model in lavaan using the lavaan.survey package. Currently, only maximum likelihood estimation for normally distributed data is available.

    The function BIFIE.survey fits a model defined in the survey package.

    -
    BIFIE.lavaan.survey(lavmodel, svyrepdes, lavaan_fun="sem",
         lavaan_survey_default=FALSE, fit.measures=NULL, ...)
     
     # S3 method for BIFIE.lavaan.survey
    -summary(object, ...)
    +summary(object, ...)
     
     # S3 method for BIFIE.lavaan.survey
    -coef(object,...)
    +coef(object,...)
     
     # S3 method for BIFIE.lavaan.survey
    -vcov(object,...)
    +vcov(object,...)
     
     BIFIE.survey(svyrepdes, survey.function, ...)
     
     # S3 method for BIFIE.survey
    -summary(object, digits=3, ...)
    +summary(object, digits=3, ...)
     
     # S3 method for BIFIE.survey
    -coef(object,...)
    +coef(object,...)
     
     # S3 method for BIFIE.survey
    -vcov(object,...)
    - +vcov(object,...) +

    Arguments

    @@ -150,7 +157,7 @@

    Arg

    +survey::svrepdesign)

    @@ -169,10 +176,10 @@

    Arg

    +lavaan::fitMeasures function

    - + @@ -184,147 +191,45 @@

    Arg

    svyrepdes

    Replication design object of class BIFIEdata or replication design object from survey package (generated by BIFIEdata2svrepdesign or -survey::svrepdesign)

    lavaan_fun
    fit.measures

    Optional vector of fit measures used in -lavaan::fitMeasures function

    ...

    Further arguments to be passed

    Number of digits after decimal

    - +

    Value

    For BIFIE.lavaan.survey a list with following entries

    lavfit

    Object of class lavaan

    fitstat

    Fit statistics from lavaan

    -

    See also

    - - +

    Examples

    -
    # NOT RUN {
    -#############################################################################
    -# EXAMPLE 1: Multiply imputed datasets, TIMSS replication design
    -#############################################################################
    -
    -library(lavaan)
    -data(data.timss2)
    -data(data.timssrep)
    -
    -#--- create BIFIEdata object
    -bdat4 <- BIFIEsurvey::BIFIE.data( data=data.timss2, wgt="TOTWGT",
    -                wgtrep=data.timssrep[,-1], fayfac=1)
    -print(bdat4)
    -
    -#--- create survey object with conversion function
    -svydes4 <- BIFIEsurvey::BIFIEdata2svrepdesign(bdat4)
    -
    -#*** regression model
    -mod1 <- BIFIEsurvey::BIFIE.linreg(bdat4, formula=ASMMAT ~ ASSSCI )
    -mod2 <- mitools::MIcombine( with(svydes4, survey::svyglm( formula=ASMMAT ~ ASSSCI,
    -                       design=svydes4 )))
    -#--- regression with lavaan.survey package
    -lavmodel <- "ASMMAT ~ 1
    -             ASMMAT ~ ASSSCI"
    -mod3 <- BIFIEsurvey::BIFIE.lavaan.survey(lavmodel, svyrepdes=svydes4)
    -# inference included in lavaan.survey package
    -mod4 <- BIFIEsurvey::BIFIE.lavaan.survey(lavmodel, svyrepdes=svydes4,
    -                        lavaan_survey_default=TRUE)
    -summary(mod3)
    -# extract fit statistics
    -lavaan::fitMeasures(mod3$lavfit)
    -
    -#--- use BIFIE.lavaan.survey function with BIFIEdata object
    -mod5 <- BIFIEsurvey::BIFIE.lavaan.survey(lavmodel, svyrepdes=bdat4)
    -summary(mod5)
    -
    -# compare estimated parameters
    -coef(mod1); coef(mod2); coef(mod3); coef(mod4); coef(mod5)
    -
    -# compare standard error estimates
    -se(mod1); BIFIEsurvey::se(mod2); BIFIEsurvey::se(mod3); BIFIEsurvey::se(mod4); BIFIEsurvey::se(mod5)
    -
    -#############################################################################
    -# EXAMPLE 2: Examples BIFIE.survey function
    -#############################################################################
    -
    -data(data.timss2)
    -data(data.timssrep)
    -
    -#--- create BIFIEdata object
    -bdat <- BIFIEsurvey::BIFIE.data( data=data.timss2, wgt="TOTWGT",
    -              wgtrep=data.timssrep[,-1], fayfac=1)
    -print(bdat)
    -
    -#--- survey object
    -sdat <- BIFIEsurvey::BIFIEdata2svrepdesign(bdat)
    -print(sdat)
    -
    -#- fit models in survey
    -mod1 <- BIFIEsurvey::BIFIE.linreg(bdat, formula=ASMMAT~ASSSCI)
    -mod2 <- BIFIEsurvey::BIFIE.survey( sdat, survey.function=survey::svyglm,
    -                                    formula=ASMMAT~ASSSCI)
    -mod3 <- BIFIEsurvey::BIFIE.survey( bdat, survey.function=survey::svyglm,
    -                                     formula=ASMMAT~ASSSCI)
    -summary(mod1)
    -summary(mod2)
    -summary(mod3)
    -
    -#############################################################################
    -# EXAMPLE 3: Nested multiply imputed datasets | linear regression
    -#############################################################################
    -
    -library(lavaan)
    -data(data.timss4)
    -data(data.timssrep)
    -
    -# nested imputed dataset
    -bdat <- BIFIEsurvey::BIFIE.data( data.list=data.timss4,
    -            wgt=data.timss4[[1]][[1]]$TOTWGT, wgtrep=data.timssrep[, -1 ],  NMI=TRUE )
    -summary(bdat)
    -
    -#*** BIFIEsurvey::BIFIE.linreg
    -mod1 <- BIFIEsurvey::BIFIE.linreg(bdat, formula=ASMMAT ~ migrant )
    -
    -#*** survey::svyglm
    -mod2 <- BIFIEsurvey::BIFIE.survey(bdat, survey.function=survey::svyglm,
    -                                    formula=ASMMAT~migrant)
    -
    -#*** lavaan.survey::lavaan.survey
    -lavmodel <- "ASMMAT ~ 1
    -             ASMMAT ~ migrant"
    -mod3 <- BIFIEsurvey::BIFIE.lavaan.survey(lavmodel, svyrepdes=bdat)
    -
    -coef(mod1); coef(mod2); coef(mod3)
    -se(mod1); BIFIEsurvey::se(mod2), BIFIEsurvey::se(mod3)
    -# }
    -
    +
    
       
    - +
    -

    Site built with pkgdown 1.3.0.

    +

    Site built with pkgdown 1.5.1.

    +
    + + diff --git a/docs/reference/BIFIE.linreg.html b/docs/reference/BIFIE.linreg.html index 46c863c..2aadd66 100644 --- a/docs/reference/BIFIE.linreg.html +++ b/docs/reference/BIFIE.linreg.html @@ -8,21 +8,29 @@ Linear Regression — BIFIE.linreg • BIFIEsurvey + - + - + + - + + + + + - + + - + - - + + + @@ -30,10 +38,10 @@ - + - + @@ -47,9 +55,10 @@ + - +
    +
    @@ -105,23 +114,21 @@

    Linear Regression

    -

    Computes linear regression.

    -
    BIFIE.linreg(BIFIEobj, dep=NULL, pre=NULL, formula=NULL,
         group=NULL, group_values=NULL, se=TRUE)
     
     # S3 method for BIFIE.linreg
    -summary(object,digits=4,...)
    +summary(object,digits=4,...)
     
     # S3 method for BIFIE.linreg
    -coef(object,...)
    +coef(object,...)
     
     # S3 method for BIFIE.linreg
    -vcov(object,...)
    - +vcov(object,...) +

    Arguments

    @@ -167,105 +174,102 @@

    Arg

    - +

    Number of digits for rounding output

    ...

    Further arguments to be passed

    - +

    Value

    A list with following entries

    stat

    Data frame with unstandardized and standardized regression coefficients, residual standard deviation and \(R^2\)

    output

    Extensive output with all replicated statistics

    -

    More values

    +
    ...

    More values

    -

    See also

    -

    Alternative implementations: survey::svyglm, -intsvy::timss.reg, -intsvy::timss.reg.pv, -stats::lm

    +

    Alternative implementations: survey::svyglm, +intsvy::timss.reg, +intsvy::timss.reg.pv, +stats::lm

    See BIFIE.logistreg for logistic regression.

    -

    Examples

    -
    # NOT RUN {
    -#############################################################################
    +    
    #############################################################################
     # EXAMPLE 1: Imputed TIMSS dataset
     #############################################################################
     
    -data(data.timss1)
    -data(data.timssrep)
    +data(data.timss1)
    +data(data.timssrep)
     
     # create BIFIE.dat object
    -bdat <- BIFIEsurvey::BIFIE.data( data.list=data.timss1, wgt=data.timss1[[1]]$TOTWGT,
    +bdat <- BIFIEsurvey::BIFIE.data( data.list=data.timss1, wgt=data.timss1[[1]]$TOTWGT,
                  wgtrep=data.timssrep[, -1 ] )
     
     #**** Model 1: Linear regression for mathematics score
    -mod1 <- BIFIEsurvey::BIFIE.linreg( bdat, dep="ASMMAT", pre=c("one","books","migrant"),
    +mod1 <- BIFIEsurvey::BIFIE.linreg( bdat, dep="ASMMAT", pre=c("one","books","migrant"),
                   group="female" )
    -summary(mod1)
    +summary(mod1)
     
    -# }# NOT RUN {
    +if (FALSE) {
     # same model but specified with R formulas
    -mod1a <- BIFIEsurvey::BIFIE.linreg( bdat, formula=ASMMAT ~ books + migrant,
    +mod1a <- BIFIEsurvey::BIFIE.linreg( bdat, formula=ASMMAT ~ books + migrant,
                    group="female", group_values=0:1 )
    -summary(mod1a)
    +summary(mod1a)
     
     # compare result with lm function and first imputed dataset
     dat1 <- data.timss1[[1]]
    -mod1b <- stats::lm( ASMMAT ~ 0 + as.factor(female) + as.factor(female):books +
    -                              as.factor(female):migrant,
    +mod1b <- stats::lm( ASMMAT ~ 0 + as.factor(female) + as.factor(female):books +
    +                              as.factor(female):migrant,
                              data=dat1,  weights=dat1$TOTWGT )
    -summary(mod1b)
    +summary(mod1b)
     
     #**** Model 2: Like Model 1, but books is now treated as a factor
    -mod2 <- BIFIEsurvey::BIFIE.linreg( bdat, formula=ASMMAT ~ as.factor(books) + migrant)
    -summary(mod2)
    +mod2 <- BIFIEsurvey::BIFIE.linreg( bdat, formula=ASMMAT ~ as.factor(books) + migrant)
    +summary(mod2)
     
     #############################################################################
     # EXAMPLE 2: PISA data | Nonlinear regression models
     #############################################################################
     
    -data(data.pisaNLD)
    +data(data.pisaNLD)
     data <- data.pisaNLD
     
     #--- Create BIFIEdata object immediately using BIFIE.data.jack function
    -bdat <- BIFIEsurvey::BIFIE.data.jack( data.pisaNLD, jktype="RW_PISA", cdata=TRUE)
    -summary(bdat)
    +bdat <- BIFIEsurvey::BIFIE.data.jack( data.pisaNLD, jktype="RW_PISA", cdata=TRUE)
    +summary(bdat)
     
     #****************************************************
     #*** Model 1: linear regression
    -mod1 <- BIFIEsurvey::BIFIE.linreg( bdat, formula=MATH ~ HISEI )
    -summary(mod1)
    +mod1 <- BIFIEsurvey::BIFIE.linreg( bdat, formula=MATH ~ HISEI )
    +summary(mod1)
     
     #****************************************************
     #*** Model 2: Cubic regression
    -mod2 <- BIFIEsurvey::BIFIE.linreg( bdat, formula=MATH ~ HISEI + I(HISEI^2) + I(HISEI^3) )
    -summary(mod2)
    +mod2 <- BIFIEsurvey::BIFIE.linreg( bdat, formula=MATH ~ HISEI + I(HISEI^2) + I(HISEI^3) )
    +summary(mod2)
     
     #****************************************************
     #*** Model 3: B-spline regression
     
     # test with design of HISEI values
    -dfr <- data.frame("HISEI"=16:90 )
    -des <- stats::model.frame( ~ splines::bs( HISEI, df=5 ), dfr )
    +dfr <- data.frame("HISEI"=16:90 )
    +des <- stats::model.frame( ~ splines::bs( HISEI, df=5 ), dfr )
     des <- des$splines
    -plot( dfr$HISEI, des[,1], type="l", pch=1, lwd=2, ylim=c(0,1) )
    -for (vv in 2:ncol(des) ){
    -    lines( dfr$HISEI, des[,vv], lty=vv, col=vv, lwd=2)
    +plot( dfr$HISEI, des[,1], type="l", pch=1, lwd=2, ylim=c(0,1) )
    +for (vv in 2:ncol(des) ){
    +    lines( dfr$HISEI, des[,vv], lty=vv, col=vv, lwd=2)
     }
     
     # apply B-spline regression in BIFIEsurvey::BIFIE.linreg
    -mod3 <- BIFIEsurvey::BIFIE.linreg( bdat, formula=MATH ~ splines::bs(HISEI,df=5) )
    -summary(mod3)
    +mod3 <- BIFIEsurvey::BIFIE.linreg( bdat, formula=MATH ~ splines::bs(HISEI,df=5) )
    +summary(mod3)
     
     #*** include transformed HISEI values for B-spline matrix in bdat
    -bdat2 <- BIFIEsurvey::BIFIE.data.transform( bdat, ~ 0 + splines::bs( HISEI, df=5 ))
    -bdat2$varnames[ bdat2$varsindex.added ] <- paste0("HISEI_bsdes",
    -            seq( 1, length( bdat2$varsindex.added ) ) )
    +bdat2 <- BIFIEsurvey::BIFIE.data.transform( bdat, ~ 0 + splines::bs( HISEI, df=5 ))
    +bdat2$varnames[ bdat2$varsindex.added ] <- paste0("HISEI_bsdes",
    +            seq( 1, length( bdat2$varsindex.added ) ) )
     
     #****************************************************
     #*** Model 4: Nonparametric regression using BIFIE.by
    @@ -274,68 +278,64 @@ 

    Examp #---- (1) test function with one dataset dat1 <- bdat$dat1 -vars <- c("MATH", "HISEI") +vars <- c("MATH", "HISEI") X <- dat1[,vars] w <- bdat$wgt -X <- as.data.frame(X) +X <- as.data.frame(X) # estimate model -mod <- stats::loess( MATH ~ HISEI, weights=w, data=X ) +mod <- stats::loess( MATH ~ HISEI, weights=w, data=X ) # predict HISEI values -hisei_val <- data.frame( "HISEI"=seq(16,90) ) -y_pred <- stats::predict( mod, hisei_val ) -graphics::plot( hisei_val$HISEI, y_pred, type="l") +hisei_val <- data.frame( "HISEI"=seq(16,90) ) +y_pred <- stats::predict( mod, hisei_val ) +graphics::plot( hisei_val$HISEI, y_pred, type="l") #--- (2) define loess function loess_fct <- function(X,w){ - X1 <- data.frame( X, w ) - colnames(X1) <- c( vars, "wgt") - X1 <- stats::na.omit(X1) + X1 <- data.frame( X, w ) + colnames(X1) <- c( vars, "wgt") + X1 <- stats::na.omit(X1) # mod <- stats::lm( MATH ~ HISEI, weights=X1$wgt, data=X1 ) - mod <- stats::loess( MATH ~ HISEI, weights=X1$wgt, data=X1 ) - y_pred <- stats::predict( mod, hisei_val ) - return(y_pred) + mod <- stats::loess( MATH ~ HISEI, weights=X1$wgt, data=X1 ) + y_pred <- stats::predict( mod, hisei_val ) + return(y_pred) } #--- (3) estimate model -mod4 <- BIFIEsurvey::BIFIE.by( bdat, vars, userfct=loess_fct ) -summary(mod4) +mod4 <- BIFIEsurvey::BIFIE.by( bdat, vars, userfct=loess_fct ) +summary(mod4) # plot linear function pointwise and confidence intervals -graphics::plot( hisei_val$HISEI, mod4$stat$est, type="l", lwd=2, - xlab="HISEI", ylab="PVMATH", ylim=c(430,670) ) -graphics::lines( hisei_val$HISEI, mod4$stat$est - 1.96* mod4$stat$SE, lty=3 ) -graphics::lines( hisei_val$HISEI, mod4$stat$est + 1.96* mod4$stat$SE, lty=3 ) -# }

    +graphics::plot( hisei_val$HISEI, mod4$stat$est, type="l", lwd=2, + xlab="HISEI", ylab="PVMATH", ylim=c(430,670) ) +graphics::lines( hisei_val$HISEI, mod4$stat$est - 1.96* mod4$stat$SE, lty=3 ) +graphics::lines( hisei_val$HISEI, mod4$stat$est + 1.96* mod4$stat$SE, lty=3 ) +}
    - +
    -

    Site built with pkgdown 1.3.0.

    +

    Site built with pkgdown 1.5.1.

    +
    + + diff --git a/docs/reference/BIFIE.logistreg.html b/docs/reference/BIFIE.logistreg.html index ea4bc27..50ad429 100644 --- a/docs/reference/BIFIE.logistreg.html +++ b/docs/reference/BIFIE.logistreg.html @@ -8,21 +8,29 @@ Logistic Regression — BIFIE.logistreg • BIFIEsurvey + - + - + + - + + + + + - + + - + - - + + + @@ -30,11 +38,11 @@ - + - + @@ -48,9 +56,10 @@ + - +
    +
    @@ -106,24 +115,22 @@

    Logistic Regression

    -

    Computes logistic regression. Explained variance \(R^2\) is computed by the approach of McKelvey and Zavoina.

    -
    BIFIE.logistreg(BIFIEobj, dep=NULL, pre=NULL, formula=NULL,
         group=NULL, group_values=NULL, se=TRUE, eps=1E-8, maxiter=100)
     
     # S3 method for BIFIE.logistreg
    -summary(object,digits=4,...)
    +summary(object,digits=4,...)
     
     # S3 method for BIFIE.logistreg
    -coef(object,...)
    +coef(object,...)
     
     # S3 method for BIFIE.logistreg
    -vcov(object,...)
    - +vcov(object,...) +

    Arguments

    @@ -177,106 +184,99 @@

    Arg

    - +

    Number of digits for rounding output

    ...

    Further arguments to be passed

    - +

    Value

    A list with following entries

    stat

    Data frame with regression coefficients

    output

    Extensive output with all replicated statistics

    -

    More values

    +
    ...

    More values

    -

    See also

    -

    survey::svyglm, -stats::glm

    +

    survey::svyglm, +stats::glm

    For linear regressions see BIFIE.linreg.

    -

    Examples

    -
    # NOT RUN {
    -#############################################################################
    +    
    #############################################################################
     # EXAMPLE 1: TIMSS dataset | Logistic regression
     #############################################################################
     
    -data(data.timss2)
    -data(data.timssrep)
    +data(data.timss2)
    +data(data.timssrep)
     
     # create BIFIE.dat object
    -bdat <- BIFIEsurvey::BIFIE.data( data.list=data.timss2, wgt=data.timss2[[1]]$TOTWGT,
    +bdat <- BIFIEsurvey::BIFIE.data( data.list=data.timss2, wgt=data.timss2[[1]]$TOTWGT,
                           wgtrep=data.timssrep[, -1 ] )
     
     #**** Model 1: Logistic regression - prediction of migrational background
    -res1 <- BIFIEsurvey::BIFIE.logistreg( BIFIEobj=bdat, dep="migrant",
    -           pre=c("one","books","lang"), group="female", se=FALSE )
    -summary(res1)
    +res1 <- BIFIEsurvey::BIFIE.logistreg( BIFIEobj=bdat, dep="migrant",
    +           pre=c("one","books","lang"), group="female", se=FALSE )
    +summary(res1)
     
    -# }# NOT RUN {
    +if (FALSE) {
     # same model, but with formula specification and standard errors
    -res1a <- BIFIEsurvey::BIFIE.logistreg( BIFIEobj=bdat,
    +res1a <- BIFIEsurvey::BIFIE.logistreg( BIFIEobj=bdat,
                   formula=migrant ~ books + lang, group="female"  )
    -summary(res1a)
    +summary(res1a)
     
     #############################################################################
     # SIMULATED EXAMPLE 2: Comparison of stats::glm and BIFIEsurvey::BIFIE.logistreg
     #############################################################################
     
     #*** (1) simulate data
    -set.seed(987)
    +set.seed(987)
     N <- 300
    -x1 <- stats::rnorm(N)
    -x2 <- stats::runif(N)
    +x1 <- stats::rnorm(N)
    +x2 <- stats::runif(N)
     ypred <- -0.75+.2*x1 + 3*x2
    -y <- 1*( stats::plogis(ypred) > stats::runif(N) )
    -data <- data.frame( "y"=y, "x1"=x1, "x2"=x2 )
    +y <- 1*( stats::plogis(ypred) > stats::runif(N) )
    +data <- data.frame( "y"=y, "x1"=x1, "x2"=x2 )
     
     #*** (2) estimation logistic regression using glm
    -mod1 <- stats::glm( y ~ x1 + x2, family="binomial")
    +mod1 <- stats::glm( y ~ x1 + x2, family="binomial")
     
     #*** (3) estimation logistic regression using BIFIEdata
     # create BIFIEdata object by defining 30 Jackknife zones
    -bifiedata <- BIFIEsurvey::BIFIE.data.jack( data, jktype="JK_RANDOM", ngr=30 )
    -summary(bifiedata)
    +bifiedata <- BIFIEsurvey::BIFIE.data.jack( data, jktype="JK_RANDOM", ngr=30 )
    +summary(bifiedata)
     # estimate logistic regression
    -mod2 <- BIFIEsurvey::BIFIE.logistreg( bifiedata, formula=y ~ x1+x2 )
    +mod2 <- BIFIEsurvey::BIFIE.logistreg( bifiedata, formula=y ~ x1+x2 )
     
     #*** (4) compare results
    -summary(mod2)    # BIFIE.logistreg
    -summary(mod1)   # glm
    -# }
    +summary(mod2) # BIFIE.logistreg +summary(mod1) # glm +}
    - +
    -

    Site built with pkgdown 1.3.0.

    +

    Site built with pkgdown 1.5.1.

    +
    + + diff --git a/docs/reference/BIFIE.mva.html b/docs/reference/BIFIE.mva.html index 8782ad8..bf04349 100644 --- a/docs/reference/BIFIE.mva.html +++ b/docs/reference/BIFIE.mva.html @@ -8,21 +8,29 @@ Missing Value Analysis — BIFIE.mva • BIFIEsurvey + - + - + + + + - + + + - + + - + - - + + + @@ -30,10 +38,10 @@ - + - + @@ -47,9 +55,10 @@ + - +
    +
    @@ -105,16 +114,14 @@

    Missing Value Analysis

    -

    Conducts a missing value analysis.

    -
    BIFIE.mva( BIFIEobj, missvars, covariates=NULL, se=TRUE )
     
     # S3 method for BIFIE.mva
    -summary(object,digits=4,...)
    - +summary(object,digits=4,...) +

    Arguments

    @@ -144,70 +151,65 @@

    Arg

    - +

    Number of digits for rounding output

    ...

    Further arguments to be passed

    - +

    Value

    A list with following entries

    stat.mva

    Data frame with missing value statistics

    res_list

    List with extensive output split according to each variable in missvars

    -

    More values

    +
    ...

    More values

    -

    Examples

    -
    # NOT RUN {
    -#############################################################################
    +    
    #############################################################################
     # EXAMPLE 1: Imputed TIMSS dataset
     #############################################################################
     
    -data(data.timss1)
    -data(data.timssrep)
    +data(data.timss1)
    +data(data.timssrep)
     
     # create BIFIE.dat object
    -BIFIEdata <- BIFIEsurvey::BIFIE.data( data.list=data.timss1,
    +BIFIEdata <- BIFIEsurvey::BIFIE.data( data.list=data.timss1,
                     wgt=data.timss1[[1]]$TOTWGT, wgtrep=data.timssrep[, -1 ] )
     
     # missing value analysis for "scsci" and "books" and three covariates
    -res1 <- BIFIEsurvey::BIFIE.mva( BIFIEdata, missvars=c("scsci", "books" ),
    -             covariates=c("ASMMAT", "female", "ASSSCI") )
    -summary(res1)
    +res1 <- BIFIEsurvey::BIFIE.mva( BIFIEdata, missvars=c("scsci", "books" ),
    +             covariates=c("ASMMAT", "female", "ASSSCI") )
    +summary(res1)
     
     # missing value analysis without statistical inference and without covariates
    -res2 <- BIFIEsurvey::BIFIE.mva( BIFIEdata, missvars=c("scsci", "books"), se=FALSE)
    -summary(res2)
    -# }
    +res2 <- BIFIEsurvey::BIFIE.mva( BIFIEdata, missvars=c("scsci", "books"), se=FALSE) +summary(res2)
    - +
    -

    Site built with pkgdown 1.3.0.

    +

    Site built with pkgdown 1.5.1.

    +
    + + diff --git a/docs/reference/BIFIE.pathmodel.html b/docs/reference/BIFIE.pathmodel.html index 373307d..1ef9934 100644 --- a/docs/reference/BIFIE.pathmodel.html +++ b/docs/reference/BIFIE.pathmodel.html @@ -8,21 +8,29 @@ Path Model Estimation — BIFIE.pathmodel • BIFIEsurvey + - + - + + - + + + + + - + + - + - - + + + @@ -30,8 +38,8 @@ - + - + @@ -54,9 +62,10 @@ + - +
    +
    @@ -112,7 +121,6 @@

    Path Model Estimation

    -

    This function computes a path model. Predictors are allowed to possess measurement errors. Known measurement error variances (and covariances) or reliabilities @@ -121,21 +129,20 @@

    Path Model Estimation

    dataset the measurement error variance is determined by means of calculating the reliability Cronbachs alpha. Measurement errors are handled by adjusting covariance matrices (see Buonaccorsi, 2010, Ch. 5).

    -
    BIFIE.pathmodel( BIFIEobj, lavaan.model, reliability=NULL, group=NULL,
             group_values=NULL, se=TRUE )
     
     # S3 method for BIFIE.pathmodel
    -summary(object,digits=4,...)
    +summary(object,digits=4,...)
     
     # S3 method for BIFIE.pathmodel
    -coef(object,...)
    +coef(object,...)
     
     # S3 method for BIFIE.pathmodel
    -vcov(object,...)
    - +vcov(object,...) +

    Arguments

    @@ -148,7 +155,7 @@

    Arg

    + TAM::lavaanify.IRT function.

    @@ -178,11 +185,11 @@

    Arg

    - +

    String including the model specification in lavaan syntax. lavaan.model also allows the extended functionality in the - TAM::lavaanify.IRT function.

    reliability

    Number of digits for rounding output

    ...

    Further arguments to be passed

    - +

    Details

    The following conventions are used as parameter labels in the output.

    @@ -194,7 +201,6 @@

    Details

    X-~>Y denotes the sum of all indirect effects from \(X\) to \(Y\).

    The parameter suffix _stand refers to parameters for which all variables are standardized.

    -

    Value

    A list with following entries

    @@ -202,34 +208,31 @@

    Value

    coefficients, path coefficients, total and indirect effects, residual variances, and \(R^2\)

    output

    Extensive output with all replicated statistics

    -

    More values

    +
    ...

    More values

    -

    References

    Buonaccorsi, J. P. (2010). Measurement error: Models, methods, and applications. CRC Press.

    -

    See also

    See the lavaan and lavaan.survey package.

    For the lavaan syntax, see -lavaan::lavaanify and -TAM::lavaanify.IRT

    - +lavaan::lavaanify and +TAM::lavaanify.IRT

    Examples

    -
    # NOT RUN {
    +    
    if (FALSE) {
     #############################################################################
     # EXAMPLE 1: Path model data.bifie01
     #############################################################################
     
    -data(data.bifie01)
    +data(data.bifie01)
     dat <- data.bifie01
     # create dataset with replicate weights and plausible values
    -bifieobj <- BIFIEsurvey::BIFIE.data.jack( data=dat,  jktype="JK_TIMSS",
    +bifieobj <- BIFIEsurvey::BIFIE.data.jack( data=dat,  jktype="JK_TIMSS",
                     jkzone="JKCZONE", jkrep="JKCREP", wgt="TOTWGT",
    -                pv_vars=c("ASMMAT","ASSSCI") )
    +                pv_vars=c("ASMMAT","ASSSCI") )
     
     #**************************************************************
     #*** Model 1: Path model
    @@ -243,13 +246,13 @@ 

    Examp ASBM02E ~ ASBM02A + ASBM02B " #--- Model 1a: model calculated by gender -mod1a <- BIFIEsurvey::BIFIE.pathmodel( bifieobj, lavmodel1, group="female" ) -summary(mod1a) +mod1a <- BIFIEsurvey::BIFIE.pathmodel( bifieobj, lavmodel1, group="female" ) +summary(mod1a) #--- Model 1b: Input of some known reliabilities -reliability <- c( "ASBM02B"=.6, "ASBM02A"=.8 ) -mod1b <- BIFIEsurvey::BIFIE.pathmodel( bifieobj, lavmodel1, reliability=reliability) -summary(mod1b) +reliability <- c( "ASBM02B"=.6, "ASBM02A"=.8 ) +mod1b <- BIFIEsurvey::BIFIE.pathmodel( bifieobj, lavmodel1, reliability=reliability) +summary(mod1b) #************************************************************** #*** Model 2: Linear regression with errors in predictors @@ -259,42 +262,34 @@

    Examp ASMMAT ~ ASBG07A + ASBG07B + ASBM03A ASBG07A ~~ .2*ASBG07A " -mod2 <- BIFIEsurvey::BIFIE.pathmodel( bifieobj, lavmodel2 ) -summary(mod2) -# }

    +mod2 <- BIFIEsurvey::BIFIE.pathmodel( bifieobj, lavmodel2 ) +summary(mod2) +}
    - +
    -

    Site built with pkgdown 1.3.0.

    +

    Site built with pkgdown 1.5.1.

    +
    + + diff --git a/docs/reference/BIFIE.twolevelreg.html b/docs/reference/BIFIE.twolevelreg.html index 5fac714..9d47bf4 100644 --- a/docs/reference/BIFIE.twolevelreg.html +++ b/docs/reference/BIFIE.twolevelreg.html @@ -8,21 +8,29 @@ Two Level Regression — BIFIE.twolevelreg • BIFIEsurvey + - + - + + - + + + + + - + + - + - - + + + @@ -30,13 +38,13 @@ - + - + @@ -50,9 +58,10 @@ + - +
    +
    @@ -108,12 +117,10 @@

    Two Level Regression

    -

    This function computes the hierarchical two level model with random intercepts and random slopes. The full maximum likelihood estimation is conducted by means of an EM algorithm (Raudenbush & Bryk, 2002).

    -
    BIFIE.twolevelreg( BIFIEobj, dep, formula.fixed, formula.random, idcluster,
    @@ -121,14 +128,14 @@ 

    Two Level Regression

    recov_constraint=NULL, se=TRUE, globconv=1E-6, maxiter=1000 ) # S3 method for BIFIE.twolevelreg -summary(object,digits=4,...) +summary(object,digits=4,...) # S3 method for BIFIE.twolevelreg -coef(object,...) +coef(object,...) # S3 method for BIFIE.twolevelreg -vcov(object,...)
    - +vcov(object,...) +

    Arguments

    @@ -205,11 +212,11 @@

    Arg

    - +

    Number of digits for rounding output

    ...

    Further arguments to be passed

    - +

    Details

    The implemented random slope model can be written as @@ -227,16 +234,14 @@

    Details \( \bold{X}_{ij}=\bold{X}_j^B + \bold{X}_{ij}^W\). The different sources of variance are computed by formulas as proposed in Snijders and Bosker (2012, Ch. 7).

    -

    Value

    A list with following entries

    stat

    Data frame with coefficients and different sources of variance.

    output

    Extensive output with all replicated statistics

    -

    More values

    +
    ...

    More values

    -

    References

    Raudenbush, S. W., & Bryk, A. S. (2002). @@ -245,187 +250,40 @@

    R

    Snijders, T. A. B., & Bosker, R. J. (2012). Multilevel analysis: An introduction to basic and advanced multilevel modeling. Thousand Oaks: Sage.

    -

    See also

    -

    The lme4::lmer function in the lme4 package allows only +

    The lme4::lmer function in the lme4 package allows only weights at the first level.

    See the WeMix package (and the function WeMix::mix) for estimation of mixed effects models with weights at different levels.

    -

    Examples

    -
    # NOT RUN {
    -library(lme4)
    -
    -#############################################################################
    -# EXAMPLE 1: Dataset data.bifie01 | TIMSS 2011
    -#############################################################################
    -
    -data(data.bifie01)
    -dat <- data.bifie01
    -set.seed(987)
    -
    -# create dataset with replicate weights and plausible values
    -bdat1 <- BIFIEsurvey::BIFIE.data.jack( data=dat, jktype="JK_TIMSS", jkzone="JKCZONE",
    -            jkrep="JKCREP", wgt="TOTWGT", pv_vars=c("ASMMAT","ASSSCI") )
    -
    -# create dataset without plausible values and ignoring weights
    -bdat2 <- BIFIEsurvey::BIFIE.data.jack( data=dat, jktype="JK_RANDOM", ngr=10 )
    -#=> standard errors from ML estimation
    -
    -#***********************************************
    -# Model 1: Random intercept model
    -
    -#--- Model 1a: without weights, first plausible value
    -mod1a <- BIFIEsurvey::BIFIE.twolevelreg( BIFIEobj=bdat2, dep="ASMMAT01",
    -                formula.fixed=~ 1, formula.random=~ 1, idcluster="idschool",
    -                wgtlevel2="one", se=FALSE )
    -summary(mod1a)
    -
    -#--- Model 1b: estimation in lme4
    -mod1b <- lme4::lmer( ASMMAT01 ~ 1 + ( 1 | idschool), data=dat, REML=FALSE)
    -summary(mod1b)
    -
    -#--- Model 1c: Like Model 1a but for five plausible values and ML inference
    -mod1c <- BIFIEsurvey::BIFIE.twolevelreg( BIFIEobj=bdat1, dep="ASMMAT",
    -                formula.fixed=~ 1, formula.random=~ 1, idcluster="idschool",
    -                wgtlevel2="one",  se=FALSE )
    -summary(mod1c)
    -
    -#--- Model 1d: weights and sampling design and all plausible values
    -mod1d <- BIFIEsurvey::BIFIE.twolevelreg( BIFIEobj=bdat1, dep="ASMMAT",
    -                formula.fixed=~ 1, formula.random=~ 1, idcluster="idschool",
    -                wgtlevel2="SCHWGT" )
    -summary(mod1d)
    -
    -#***********************************************
    -# Model 2: Random slope model
    -
    -#--- Model 2a: without weights
    -mod2a <- BIFIEsurvey::BIFIE.twolevelreg( BIFIEobj=bdat2, dep="ASMMAT01",
    -                formula.fixed=~  female +  ASBG06A, formula.random=~ ASBG06A,
    -                idcluster="idschool", wgtlevel2="one",  se=FALSE )
    -summary(mod2a)
    -
    -#--- Model 2b: estimation in lme4
    -mod2b <- lme4::lmer( ASMMAT01 ~ female +  ASBG06A + ( 1 + ASBG06A | idschool),
    -                   data=dat, REML=FALSE)
    -summary(mod2b)
    -
    -#--- Model 2c: weights and sampling design and all plausible values
    -mod2c <- BIFIEsurvey::BIFIE.twolevelreg( BIFIEobj=bdat1, dep="ASMMAT",
    -                formula.fixed=~  female +  ASBG06A, formula.random=~ ASBG06A,
    -                idcluster="idschool", wgtlevel2="SCHWGT", maxiter=500, se=FALSE)
    -summary(mod2c)
    -
    -#--- Model 2d: Uncorrelated intecepts and slopes
    -
    -# constraint for zero covariance between intercept and slope
    -recov_constraint <- matrix( c(1,2,0), ncol=3 )
    -mod2d <- BIFIEsurvey::BIFIE.twolevelreg( BIFIEobj=bdat2, dep="ASMMAT01",
    -                formula.fixed=~ female +  ASBG06A, formula.random=~ ASBG06A,
    -                idcluster="idschool", wgtlevel2="one",  se=FALSE,
    -                recov_constraint=recov_constraint )
    -summary(mod2d)
    -
    -#--- Model 2e: Fixed entries in the random effects covariance matrix
    -
    -# two constraints for random effects covariance
    -# Cov(Int, Slo)=0  # zero slope for intercept and slope
    -# Var(Slo)=10      # slope variance of 10
    -recov_constraint <- matrix( c(1,2,0,
    -                      2,2,10), ncol=3, byrow=TRUE)
    -mod2e <- BIFIEsurvey::BIFIE.twolevelreg( BIFIEobj=bdat2, dep="ASMMAT01",
    -                formula.fixed=~  female +  ASBG06A, formula.random=~ ASBG06A,
    -                idcluster="idschool", wgtlevel2="one",  se=FALSE,
    -                recov_constraint=recov_constraint )
    -summary(mod2e)
    -
    -#############################################################################
    -# SIMULATED EXAMPLE 2: Two-level regression with random slopes
    -#############################################################################
    -
    -#--- (1) simulate data
    -set.seed(9876)
    -NC <- 100    # number of clusters
    -Nj <- 20     # number of persons per cluster
    -iccx <- .4   # intra-class correlation predictor
    -theta <- c( 0.7, .3 )    # fixed effects
    -Tmat <- diag( c(.3, .1 ) ) # variances of random intercept and slope
    -sig2 <- .60    # residual variance
    -N <- NC*Nj
    -idcluster <- rep( 1:NC, each=Nj )
    -dat1 <- data.frame("idcluster"=idcluster )
    -dat1$X <- rep( stats::rnorm( NC, sd=sqrt(iccx) ), each=Nj ) +
    -                 stats::rnorm( N, sd=sqrt( 1 - iccx) )
    -dat1$Y <- theta[1] + rep( stats::rnorm(NC, sd=sqrt(Tmat[1,1] ) ), each=Nj ) +
    -      theta[2] + rep( stats::rnorm(NC, sd=sqrt(Tmat[2,2])), each=Nj )) * dat1$X +
    -      stats::rnorm(N, sd=sqrt(sig2) )
    -
    -#--- (2) create design object
    -bdat1 <- BIFIEsurvey::BIFIE.data.jack( data=dat1, jktype="JK_GROUP", jkzone="idcluster")
    -summary(bdat1)
    -
    -#*** Model 1: Random slope model (ML standard errors)
    -
    -#- estimation using BIFIE.twolevelreg
    -mod1a <- BIFIEsurvey::BIFIE.twolevelreg( BIFIEobj=bdat1, dep="Y",
    -                formula.fixed=~ 1+X, formula.random=~ 1+X, idcluster="idcluster",
    -                wgtlevel2="one",  se=FALSE )
    -summary(mod1a)
    -
    -#- estimation in lme4
    -mod1b <- lme4::lmer( Y ~ X + ( 1+X | idcluster), data=dat1, REML=FALSE  )
    -summary(mod1b)
    -
    -#- using Jackknife for inference
    -mod1c <- BIFIEsurvey::BIFIE.twolevelreg( BIFIEobj=bdat1, dep="Y",
    -                formula.fixed=~ 1+X, formula.random=~ 1+X, idcluster="idcluster",
    -                wgtlevel2="one",  se=TRUE )
    -summary(mod1c)
    -
    -# extract coefficients
    -coef(mod1a)
    -coef(mod1c)
    -# covariance matrix
    -vcov(mod1a)
    -vcov(mod1c)
    -# }
    -
    +
    
       
    - +
    -

    Site built with pkgdown 1.3.0.

    +

    Site built with pkgdown 1.5.1.

    +
    + + diff --git a/docs/reference/BIFIE.univar.html b/docs/reference/BIFIE.univar.html index 390e3d4..266a3fb 100644 --- a/docs/reference/BIFIE.univar.html +++ b/docs/reference/BIFIE.univar.html @@ -8,21 +8,29 @@ Univariate Descriptive Statistics (Means and Standard Deviations) — BIFIE.univar • BIFIEsurvey + - + - + + - + + + + + - + + - + - - + + + @@ -30,11 +38,11 @@ - + - + @@ -48,9 +56,10 @@ + - +
    +
    @@ -106,23 +115,21 @@

    Univariate Descriptive Statistics (Means and Standard Deviations)

    -

    Computes some univariate descriptive statistics (means and standard deviations).

    -
    BIFIE.univar(BIFIEobj, vars, group=NULL, group_values=NULL, se=TRUE)
     
     # S3 method for BIFIE.univar
    -summary(object,digits=3,...)
    +summary(object,digits=3,...)
     
     # S3 method for BIFIE.univar
    -coef(object,...)
    +coef(object,...)
     
     # S3 method for BIFIE.univar
    -vcov(object,...)
    - +vcov(object,...) +

    Arguments

    @@ -157,11 +164,11 @@

    Arg

    - +

    Number of digits for rounding output

    ...

    Further arguments to be passed

    - +

    Value

    A list with following entries

    @@ -169,105 +176,97 @@

    Value

    stat_M

    Data frame with means

    stat_SD

    Data frame with standard deviations

    output

    Extensive output with all replicated statistics

    -

    More values

    +
    ...

    More values

    -

    See also

    See BIFIE.univar.test for a test of equal means and effect sizes \(\eta\) and \(d\).

    Descriptive statistics without statistical inference can be estimated by the collection of -miceadds::ma.wtd.statNA +miceadds::ma.wtd.statNA functions from the miceadds package.

    Further descriptive functions:

    -

    survey::svymean, -intsvy::timss.mean, -intsvy::timss.mean.pv, -stats::weighted.mean, -Hmisc::wtd.mean, -miceadds::ma.wtd.meanNA

    -

    survey::svyvar, -Hmisc::wtd.var, -miceadds::ma.wtd.sdNA, -miceadds::ma.wtd.covNA

    - +

    survey::svymean, +intsvy::timss.mean, +intsvy::timss.mean.pv, +stats::weighted.mean, +Hmisc::wtd.mean, +miceadds::ma.wtd.meanNA

    +

    survey::svyvar, +Hmisc::wtd.var, +miceadds::ma.wtd.sdNA, +miceadds::ma.wtd.covNA

    Examples

    -
    # NOT RUN {
    -#############################################################################
    +    
    #############################################################################
     # EXAMPLE 1: Imputed TIMSS dataset
     #############################################################################
     
    -data(data.timss1)
    -data(data.timssrep)
    +data(data.timss1)
    +data(data.timssrep)
     
     # create BIFIE.dat object
    -bdat <- BIFIEsurvey::BIFIE.data( data.list=data.timss1, wgt=data.timss1[[1]]$TOTWGT,
    +bdat <- BIFIEsurvey::BIFIE.data( data.list=data.timss1, wgt=data.timss1[[1]]$TOTWGT,
                wgtrep=data.timssrep[, -1 ] )
     
     # compute descriptives for plausible values
    -res1 <- BIFIEsurvey::BIFIE.univar( bdat, vars=c("ASMMAT","ASSSCI","books") )
    -summary(res1)
    +res1 <- BIFIEsurvey::BIFIE.univar( bdat, vars=c("ASMMAT","ASSSCI","books") )
    +summary(res1)
     
     # split descriptives by number of books
    -res2 <- BIFIEsurvey::BIFIE.univar( bdat, vars=c("ASMMAT","ASSSCI"), group="books",
    +res2 <- BIFIEsurvey::BIFIE.univar( bdat, vars=c("ASMMAT","ASSSCI"), group="books",
                 group_values=1:5)
    -summary(res2)
    +summary(res2)
     
     #############################################################################
     # EXAMPLE 2: TIMSS dataset with missings
     #############################################################################
     
    -data(data.timss2)
    -data(data.timssrep)
    +data(data.timss2)
    +data(data.timssrep)
     
     # use first dataset with missing data from data.timss2
    -bdat1 <- BIFIEsurvey::BIFIE.data( data.list=data.timss2[[1]], wgt=data.timss2[[1]]$TOTWGT,
    +bdat1 <- BIFIEsurvey::BIFIE.data( data.list=data.timss2[[1]], wgt=data.timss2[[1]]$TOTWGT,
                    wgtrep=data.timssrep[, -1 ])
     
     # some descriptive statistics without statistical inference
    -res1a <- BIFIEsurvey::BIFIE.univar( bdat1, vars=c("ASMMAT","ASSSCI","books"), se=FALSE)
    +res1a <- BIFIEsurvey::BIFIE.univar( bdat1, vars=c("ASMMAT","ASSSCI","books"), se=FALSE)
     # descriptive statistics with statistical inference
    -res1b <- BIFIEsurvey::BIFIE.univar( bdat1, vars=c("ASMMAT","ASSSCI","books") )
    -summary(res1a)
    -summary(res1b)
    +res1b <- BIFIEsurvey::BIFIE.univar( bdat1, vars=c("ASMMAT","ASSSCI","books") )
    +summary(res1a)
    +summary(res1b)
     
     # split descriptives by number of books
    -res2 <- BIFIEsurvey::BIFIE.univar( bdat1, vars=c("ASMMAT","ASSSCI"), group="books")
    +res2 <- BIFIEsurvey::BIFIE.univar( bdat1, vars=c("ASMMAT","ASSSCI"), group="books")
     # Note that if group_values is not specified as an argument it will be
     # automatically determined by the observed frequencies in the dataset
    -summary(res2)
    -# }
    +summary(res2)
    - +
    -

    Site built with pkgdown 1.3.0.

    +

    Site built with pkgdown 1.5.1.

    +
    + + diff --git a/docs/reference/BIFIE.univar.test.html b/docs/reference/BIFIE.univar.test.html index 32b42a2..aec2294 100644 --- a/docs/reference/BIFIE.univar.test.html +++ b/docs/reference/BIFIE.univar.test.html @@ -8,21 +8,29 @@ Analysis of Variance and Effect Sizes for Univariate Statistics — BIFIE.univar.test • BIFIEsurvey + - + - + + - + + + + + - + + - + - - + + + @@ -30,12 +38,12 @@ - + - + @@ -49,9 +57,10 @@ + - +
    +
    @@ -107,18 +116,16 @@

    Analysis of Variance and Effect Sizes for Univariate Statistics

    -

    Computes a Wald test which tests equality of means (univariate analysis of variance). In addition, the \(d\) and \(\eta\) effect sizes are computed.

    -
    BIFIE.univar.test(BIFIE.method, wald_test=TRUE)
     
     # S3 method for BIFIE.univar.test
    -summary(object,digits=4,...)
    - +summary(object,digits=4,...) +

    Arguments

    @@ -140,119 +147,112 @@

    Arg

    - +

    Number of digits for rounding output

    ...

    Further arguments to be passed

    - +

    Value

    A list with following entries

    stat.F

    Data frame with \(F\) statistic for Wald test

    stat.eta

    Data frame with \(\eta\) effect size and its inference

    stat.dstat

    Data frame with Cohen's \(d\) effect size and its inference

    -

    More values

    +
    ...

    More values

    -

    See also

    -

    Examples

    -
    # NOT RUN {
    -#############################################################################
    +    
    #############################################################################
     # EXAMPLE 1: Imputed TIMSS dataset - One grouping variable
     #############################################################################
     
    -data(data.timss1)
    -data(data.timssrep)
    +data(data.timss1)
    +data(data.timssrep)
     
     # create BIFIE.dat object
    -bdat <- BIFIEsurvey::BIFIE.data( data.list=data.timss1, wgt=data.timss1[[1]]$TOTWGT,
    +bdat <- BIFIEsurvey::BIFIE.data( data.list=data.timss1, wgt=data.timss1[[1]]$TOTWGT,
                wgtrep=data.timssrep[, -1 ] )
     
     #**** Model 1: 3 variables splitted by book
    -res1 <- BIFIEsurvey::BIFIE.univar( bdat, vars=c("ASMMAT", "ASSSCI","scsci"),
    +res1 <- BIFIEsurvey::BIFIE.univar( bdat, vars=c("ASMMAT", "ASSSCI","scsci"),
                         group="books")
    -summary(res1)
    +summary(res1)
     # analysis of variance
    -tres1 <- BIFIEsurvey::BIFIE.univar.test(res1)
    -summary(tres1)
    +tres1 <- BIFIEsurvey::BIFIE.univar.test(res1)
    +summary(tres1)
     
     #**** Model 2: One variable splitted by gender
    -res2 <- BIFIEsurvey::BIFIE.univar( bdat, vars=c("ASMMAT"), group="female" )
    -summary(res2)
    +res2 <- BIFIEsurvey::BIFIE.univar( bdat, vars=c("ASMMAT"), group="female" )
    +summary(res2)
     # analysis of variance
    -tres2 <- BIFIEsurvey::BIFIE.univar.test(res2)
    -summary(tres2)
    +tres2 <- BIFIEsurvey::BIFIE.univar.test(res2)
    +summary(tres2)
     
    -# }# NOT RUN {
    +if (FALSE) {
     #**** Model 3: Univariate statistic: math
    -res3 <- BIFIEsurvey::BIFIE.univar( bdat, vars=c("ASMMAT") )
    -summary(res3)
    -tres3 <- BIFIEsurvey::BIFIE.univar.test(res3)
    +res3 <- BIFIEsurvey::BIFIE.univar( bdat, vars=c("ASMMAT") )
    +summary(res3)
    +tres3 <- BIFIEsurvey::BIFIE.univar.test(res3)
     
     #############################################################################
     # EXAMPLE 2: Imputed TIMSS dataset - Two grouping variables
     #############################################################################
     
    -data(data.timss1)
    -data(data.timssrep)
    +data(data.timss1)
    +data(data.timssrep)
     
     # create BIFIE.dat object
    -bdat <- BIFIEsurvey::BIFIE.data( data.list=data.timss1, wgt=data.timss1[[1]]$TOTWGT,
    +bdat <- BIFIEsurvey::BIFIE.data( data.list=data.timss1, wgt=data.timss1[[1]]$TOTWGT,
                       wgtrep=data.timssrep[, -1 ] )
     
     #**** Model 1: 3 variables splitted by book and female
    -res1 <- BIFIEsurvey::BIFIE.univar(bdat, vars=c("ASMMAT", "ASSSCI","scsci"),
    -                  group=c("books","female"))
    -summary(res1)
    +res1 <- BIFIEsurvey::BIFIE.univar(bdat, vars=c("ASMMAT", "ASSSCI","scsci"),
    +                  group=c("books","female"))
    +summary(res1)
     
     # analysis of variance
    -tres1 <- BIFIEsurvey::BIFIE.univar.test(res1)
    -summary(tres1)
    +tres1 <- BIFIEsurvey::BIFIE.univar.test(res1)
    +summary(tres1)
     
     # extract data frame with Cohens d statistic
     dstat <- tres1$stat.dstat
     
     # extract d values for gender comparisons with same value of books
     # -> 'books' refers to the first variable
    -ind <- which(
    -  unlist( lapply( strsplit( dstat$groupval1, "#"), FUN=function(vv){vv[1]}) )==
    -  unlist( lapply( strsplit( dstat$groupval2, "#"), FUN=function(vv){vv[1]}) )
    +ind <- which(
    +  unlist( lapply( strsplit( dstat$groupval1, "#"), FUN=function(vv){vv[1]}) )==
    +  unlist( lapply( strsplit( dstat$groupval2, "#"), FUN=function(vv){vv[1]}) )
             )
     dstat[ ind, ]
    -# }
    +}
    - +
    -

    Site built with pkgdown 1.3.0.

    +

    Site built with pkgdown 1.5.1.

    +
    + + diff --git a/docs/reference/BIFIE.waldtest.html b/docs/reference/BIFIE.waldtest.html index 6113e1b..0759baf 100644 --- a/docs/reference/BIFIE.waldtest.html +++ b/docs/reference/BIFIE.waldtest.html @@ -8,21 +8,29 @@ Wald Tests for BIFIE Methods — BIFIE.waldtest • BIFIEsurvey + - + - + + - + + + + + - + + - + - - + + + @@ -30,13 +38,13 @@ - + - + @@ -50,9 +58,10 @@ + - +
    +
    @@ -108,19 +117,17 @@

    Wald Tests for BIFIE Methods

    -

    This function performs a Wald test for objects of classes BIFIE.by, BIFIE.correl, BIFIE.crosstab, BIFIE.freq, BIFIE.linreg, BIFIE.logistreg and BIFIE.univar.

    -
    BIFIE.waldtest(BIFIE.method, Cdes, rdes, type=NULL)
     
     # S3 method for BIFIE.waldtest
    -summary(object,digits=4,...)
    - +summary(object,digits=4,...) +

    Arguments

    @@ -154,11 +161,11 @@

    Arg

    - +

    Number of digits for rounding output

    ...

    Further arguments to be passed

    - +

    Details

    The Wald test is conducted for a parameter vector \(\bold{\theta}\), @@ -167,151 +174,138 @@

    Details (Enders, 2010, Ch. 8).

    For objects of class bifie.univar, only hypotheses with respect to means are implemented.

    -

    Value

    A list with following entries

    stat.D

    Data frame with \(D_1\) and \(D_2\) statistic, degrees of freedom and p value

    -

    More values

    +
    ...

    More values

    -

    References

    Enders, C. K. (2010). Applied missing data analysis. Guilford Press.

    -

    See also

    - - +

    Examples

    -
    # NOT RUN {
    -#############################################################################
    +    
    #############################################################################
     # EXAMPLE 1: Imputed TIMSS dataset
     #############################################################################
     
    -data(data.timss1)
    -data(data.timssrep)
    +data(data.timss1)
    +data(data.timssrep)
     
     # create BIFIE.dat object
    -bdat <- BIFIEsurvey::BIFIE.data( data.list=data.timss1, wgt=data.timss1[[1]]$TOTWGT,
    +bdat <- BIFIEsurvey::BIFIE.data( data.list=data.timss1, wgt=data.timss1[[1]]$TOTWGT,
                wgtrep=data.timssrep[, -1 ] )
     
     #******************
     #*** Model 1: Linear regression
    -res1 <- BIFIEsurvey::BIFIE.linreg( bdat, dep="ASMMAT", pre=c("one","books","migrant"),
    +res1 <- BIFIEsurvey::BIFIE.linreg( bdat, dep="ASMMAT", pre=c("one","books","migrant"),
              group="female" )
    -summary(res1)
    +summary(res1)
     
     #*** Wald test which tests whether sigma and R^2 values are the same
     res1$parnames    # parameter names
    -pn <- res1$parnames ; PN <- length(pn)
    -Cdes <- matrix(0,nrow=2, ncol=PN)
    -colnames(Cdes) <- pn
    +pn <- res1$parnames ; PN <- length(pn)
    +Cdes <- matrix(0,nrow=2, ncol=PN)
    +colnames(Cdes) <- pn
     # equality of R^2  ( R^2(female0) - R^2(female1)=0 )
    -Cdes[ 1, c("R^2_NA_female_0", "R^2_NA_female_1" ) ] <- c(1,-1)
    +Cdes[ 1, c("R^2_NA_female_0", "R^2_NA_female_1" ) ] <- c(1,-1)
     # equality of sigma ( sigma(female0) - sigma(female1)=0)
    -Cdes[ 2, c("sigma_NA_female_0", "sigma_NA_female_1" ) ] <- c(1,-1)
    +Cdes[ 2, c("sigma_NA_female_0", "sigma_NA_female_1" ) ] <- c(1,-1)
     # design vector
    -rdes <- rep(0,2)
    +rdes <- rep(0,2)
     # perform Wald test
    -wmod1 <- BIFIEsurvey::BIFIE.waldtest( BIFIE.method=res1, Cdes=Cdes, rdes=rdes )
    -summary(wmod1)
    +wmod1 <- BIFIEsurvey::BIFIE.waldtest( BIFIE.method=res1, Cdes=Cdes, rdes=rdes )
    +summary(wmod1)
     
    -# }# NOT RUN {
    +if (FALSE) {
     #******************
     #*** Model 2: Correlations
     
     # compute some correlations
    -res2a <- BIFIEsurvey::BIFIE.correl( bdat, vars=c("ASMMAT","ASSSCI","migrant","books"))
    -summary(res2a)
    +res2a <- BIFIEsurvey::BIFIE.correl( bdat, vars=c("ASMMAT","ASSSCI","migrant","books"))
    +summary(res2a)
     
     # test whether r(MAT,migr)=r(SCI,migr) and r(MAT,books)=r(SCI,books)
    -pn <- res2a$parnames; PN <- length(pn)
    -Cdes <- matrix( 0, nrow=2, ncol=PN )
    -colnames(Cdes) <- pn
    -Cdes[ 1, c("ASMMAT_migrant", "ASSSCI_migrant") ] <- c(1,-1)
    -Cdes[ 2, c("ASMMAT_books", "ASSSCI_books") ] <- c(1,-1)
    -rdes <- rep(0,2)
    +pn <- res2a$parnames; PN <- length(pn)
    +Cdes <- matrix( 0, nrow=2, ncol=PN )
    +colnames(Cdes) <- pn
    +Cdes[ 1, c("ASMMAT_migrant", "ASSSCI_migrant") ] <- c(1,-1)
    +Cdes[ 2, c("ASMMAT_books", "ASSSCI_books") ] <- c(1,-1)
    +rdes <- rep(0,2)
     # perform Wald test
    -wres2a <- BIFIEsurvey::BIFIE.waldtest( res2a, Cdes, rdes )
    -summary(wres2a)
    +wres2a <- BIFIEsurvey::BIFIE.waldtest( res2a, Cdes, rdes )
    +summary(wres2a)
     
     #******************
     #*** Model 3: Frequencies
     
     # Number of books splitted by gender
    -res3a <- BIFIEsurvey::BIFIE.freq( bdat, vars=c("books"), group="female" )
    -summary(res3a)
    +res3a <- BIFIEsurvey::BIFIE.freq( bdat, vars=c("books"), group="female" )
    +summary(res3a)
     
     # test whether book(cat4,female0)+book(cat5,female0)=book(cat4,female1)+book(cat5,female5)
     pn <- res3a$parnames
    -PN <- length(pn)
    -Cdes <- matrix( 0, nrow=1, ncol=PN )
    -colnames(Cdes) <- pn
    -Cdes[ 1, c("books_4_female_0", "books_5_female_0",
    -    "books_4_female_1", "books_5_female_1" ) ] <- c(1,1,-1,-1)
    -rdes <- c(0)
    +PN <- length(pn)
    +Cdes <- matrix( 0, nrow=1, ncol=PN )
    +colnames(Cdes) <- pn
    +Cdes[ 1, c("books_4_female_0", "books_5_female_0",
    +    "books_4_female_1", "books_5_female_1" ) ] <- c(1,1,-1,-1)
    +rdes <- c(0)
     # Wald test
    -wres3a <- BIFIEsurvey::BIFIE.waldtest( res3a, Cdes, rdes )
    -summary(wres3a)
    +wres3a <- BIFIEsurvey::BIFIE.waldtest( res3a, Cdes, rdes )
    +summary(wres3a)
     
     #******************
     #*** Model 4: Means
     
     # math and science score splitted by gender
    -res4a <- BIFIEsurvey::BIFIE.univar( bdat, vars=c("ASMMAT","ASSSCI"), group="female")
    -summary(res4a)
    +res4a <- BIFIEsurvey::BIFIE.univar( bdat, vars=c("ASMMAT","ASSSCI"), group="female")
    +summary(res4a)
     
     # test whether there are significant gender differences in math and science
     #=> multivariate ANOVA
     pn <- res4a$parnames
    -PN <- length(pn)
    -Cdes <- matrix( 0, nrow=2, ncol=PN )
    -colnames(Cdes) <- pn
    -Cdes[ 1, c("ASMMAT_female_0", "ASMMAT_female_1"  ) ] <- c(1,-1)
    -Cdes[ 2, c("ASSSCI_female_0", "ASSSCI_female_1"  ) ] <- c(1,-1)
    -rdes <- rep(0,2)
    +PN <- length(pn)
    +Cdes <- matrix( 0, nrow=2, ncol=PN )
    +colnames(Cdes) <- pn
    +Cdes[ 1, c("ASMMAT_female_0", "ASMMAT_female_1"  ) ] <- c(1,-1)
    +Cdes[ 2, c("ASSSCI_female_0", "ASSSCI_female_1"  ) ] <- c(1,-1)
    +rdes <- rep(0,2)
     # Wald test
    -wres4a <- BIFIEsurvey::BIFIE.waldtest( res4a, Cdes, rdes )
    -summary(wres4a)
    -# }
    +wres4a <- BIFIEsurvey::BIFIE.waldtest( res4a, Cdes, rdes ) +summary(wres4a) +}
    - +
    -

    Site built with pkgdown 1.3.0.

    +

    Site built with pkgdown 1.5.1.

    +
    + + diff --git a/docs/reference/BIFIEdata2svrepdesign.html b/docs/reference/BIFIEdata2svrepdesign.html index 349e149..cfd4c2a 100644 --- a/docs/reference/BIFIEdata2svrepdesign.html +++ b/docs/reference/BIFIEdata2svrepdesign.html @@ -9,21 +9,29 @@ Conversion of a <code>BIFIEdata</code> Object into a <code>svyrep</code> Object in the <span class="pkg">survey</span> Package (and the other way around) — BIFIEdata2svrepdesign • BIFIEsurvey + - + - + + - + + + + + - + + - + - - + + + @@ -31,14 +39,14 @@ + survey Package (and the other way around) — BIFIEdata2svrepdesign" /> - - + @@ -52,9 +60,10 @@ + - +
    +
    @@ -111,18 +120,16 @@

    Conversion of a BIFIEdata Object into a svyrep Obj

    -

    The function BIFIEdata2svrepdesign converts of a BIFIEdata object into a svyrep object in the survey package.

    The function svrepdesign2BIFIEdata converts a svyrep object in the survey package into an object of class BIFIEdata.

    -
    BIFIEdata2svrepdesign(bifieobj, varnames=NULL, impdata.index=NULL)
     
     svrepdesign2BIFIEdata(svrepdesign, varnames=NULL, cdata=FALSE)
    - +

    Arguments

    @@ -148,124 +155,118 @@

    Arg saved in compact format

    - +

    Value

    Function BIFIEdata2svrepdesign: Object of class svyrep.design or svyimputationList

    Function svrepdesign2BIFIEdata: Object of class BIFIEdata

    -

    See also

    See the BIFIE.data function for creating objects of class BIFIEdata in BIFIEsurvey.

    -

    See the survey::svrepdesign function in +

    See the survey::svrepdesign function in the survey package.

    -

    Examples

    -
    # NOT RUN {
    +    
    if (FALSE) {
     #############################################################################
     # EXAMPLE 1: One dataset, TIMSS replication design
     #############################################################################
     
    -data(data.timss3)
    -data(data.timssrep)
    +data(data.timss3)
    +data(data.timssrep)
     
     #--- create BIFIEdata object
    -bdat3 <- BIFIEsurvey::BIFIE.data.jack(data.timss3, jktype="JK_TIMSS")
    -summary(bdat3)
    +bdat3 <- BIFIEsurvey::BIFIE.data.jack(data.timss3, jktype="JK_TIMSS")
    +summary(bdat3)
     
     #--- create survey object directly in survey package
    -dat3a <- as.data.frame( cbind( data.timss3, data.timssrep ) )
    -RR <- ncol(data.timssrep) - 1       # number of jackknife zones
    -svydes3a <- survey::svrepdesign(data=dat3a, weights=~TOTWGT,type="JKn",
    -                 repweights='w_fstr[0-9]', scale=1,  rscales=rep(1,RR), mse=TRUE )
    -print(svydes3a)
    +dat3a <- as.data.frame( cbind( data.timss3, data.timssrep ) )
    +RR <- ncol(data.timssrep) - 1       # number of jackknife zones
    +svydes3a <- survey::svrepdesign(data=dat3a, weights=~TOTWGT,type="JKn",
    +                 repweights='w_fstr[0-9]', scale=1,  rscales=rep(1,RR), mse=TRUE )
    +print(svydes3a)
     
     #--- create survey object by converting the BIFIEdata object to survey
    -svydes3b <- BIFIEsurvey::BIFIEdata2svrepdesign(bdat3)
    +svydes3b <- BIFIEsurvey::BIFIEdata2svrepdesign(bdat3)
     
     #--- convert survey object into BIFIEdata object
    -bdat3e <- BIFIEsurvey::svrepdesign2BIFIEdata(svrepdesign=svydes3b)
    +bdat3e <- BIFIEsurvey::svrepdesign2BIFIEdata(svrepdesign=svydes3b)
     
     #*** compare results for the mean in Mathematics scores
    -mod1a <- BIFIEsurvey::BIFIE.univar( bdat3, vars="ASMMAT1")
    -mod1b <- survey::svymean( ~ ASMMAT1, design=svydes3a )
    -mod1c <- survey::svymean( ~ ASMMAT1, design=svydes3b )
    +mod1a <- BIFIEsurvey::BIFIE.univar( bdat3, vars="ASMMAT1")
    +mod1b <- survey::svymean( ~ ASMMAT1, design=svydes3a )
    +mod1c <- survey::svymean( ~ ASMMAT1, design=svydes3b )
     lavmodel <- "ASMMAT1 ~ 1"
    -mod1d <- BIFIEsurvey::BIFIE.lavaan.survey(lavmodel, svyrepdes=svydes3b)
    +mod1d <- BIFIEsurvey::BIFIE.lavaan.survey(lavmodel, svyrepdes=svydes3b)
     
     #- coefficients
    -coef(mod1a); coef(mod1b); coef(mod1c); coef(mod1d)[1]
    +coef(mod1a); coef(mod1b); coef(mod1c); coef(mod1d)[1]
     #- standard errors
    -survey::SE(mod1a); survey::SE(mod1b); survey::SE(mod1c); sqrt(vcov(mod1d)[1,1])
    +survey::SE(mod1a); survey::SE(mod1b); survey::SE(mod1c); sqrt(vcov(mod1d)[1,1])
     
     #############################################################################
     # EXAMPLE 2: Multiply imputed datasets, TIMSS replication design
     #############################################################################
     
    -data(data.timss2)
    -data(data.timssrep)
    +data(data.timss2)
    +data(data.timssrep)
     
     #--- create BIFIEdata object
    -bdat4 <- BIFIEsurvey::BIFIE.data( data=data.timss2, wgt="TOTWGT",
    +bdat4 <- BIFIEsurvey::BIFIE.data( data=data.timss2, wgt="TOTWGT",
                   wgtrep=data.timssrep[,-1], fayfac=1)
    -print(bdat4)
    +print(bdat4)
     
     #--- create object with imputed datasets in survey
    -datL <- mitools::imputationList( data.timss2 )
    -RR <- ncol(data.timssrep) - 1
    +datL <- mitools::imputationList( data.timss2 )
    +RR <- ncol(data.timssrep) - 1
     weights <- data.timss2[[1]]$TOTWGT
     repweights <-  data.timssrep[,-1]
    -svydes4a <- survey::svrepdesign(data=datL, weights=weights, type="other",
    -               repweights=repweights, scale=1,  rscales=rep(1,RR), mse=TRUE)
    -print(svydes4a)
    +svydes4a <- survey::svrepdesign(data=datL, weights=weights, type="other",
    +               repweights=repweights, scale=1,  rscales=rep(1,RR), mse=TRUE)
    +print(svydes4a)
     
     #--- create BIFIEdata object with conversion function
    -svydes4b <- BIFIEsurvey::BIFIEdata2svrepdesign(bdat4)
    +svydes4b <- BIFIEsurvey::BIFIEdata2svrepdesign(bdat4)
     
     #--- reconvert survey object into BIFIEdata object
    -bdat4c <- BIFIEsurvey::svrepdesign2BIFIEdata(svrepdesign=svydes4b)
    +bdat4c <- BIFIEsurvey::svrepdesign2BIFIEdata(svrepdesign=svydes4b)
     
     #*** compare results for a mean
    -mod1a <- BIFIEsurvey::BIFIE.univar(bdat4, vars="ASMMAT")
    -mod1b <- mitools::MIcombine( with(svydes4a, survey::svymean( ~ ASMMAT, design=svydes4a )))
    -mod1c <- mitools::MIcombine( with(svydes4b, survey::svymean( ~ ASMMAT, design=svydes4b )))
    +mod1a <- BIFIEsurvey::BIFIE.univar(bdat4, vars="ASMMAT")
    +mod1b <- mitools::MIcombine( with(svydes4a, survey::svymean( ~ ASMMAT, design=svydes4a )))
    +mod1c <- mitools::MIcombine( with(svydes4b, survey::svymean( ~ ASMMAT, design=svydes4b )))
     
     # results
    -coef(mod1a); coef(mod1b); coef(mod1c)
    -survey::SE(mod1a); survey::SE(mod1b); survey::SE(mod1c)
    -# }
    +coef(mod1a); coef(mod1b); coef(mod1c) +survey::SE(mod1a); survey::SE(mod1b); survey::SE(mod1c) +}
    - +
    -

    Site built with pkgdown 1.3.0.

    +

    Site built with pkgdown 1.5.1.

    +
    + + diff --git a/docs/reference/BIFIEsurvey-package.html b/docs/reference/BIFIEsurvey-package.html index 064e3db..88c079a 100644 --- a/docs/reference/BIFIEsurvey-package.html +++ b/docs/reference/BIFIEsurvey-package.html @@ -8,21 +8,29 @@ Tools for Survey Statistics in Educational Assessment — BIFIEsurvey-package • BIFIEsurvey + - + - + + - + + + + + - + + - + - - + + + @@ -30,8 +38,8 @@ - + - + @@ -64,9 +72,10 @@ + - +
    +
    @@ -122,7 +131,6 @@

    Tools for Survey Statistics in Educational Assessment

    -

    Contains tools for survey statistics (especially in educational assessment) for datasets with replication designs (jackknife, bootstrap, replicate weights; see Kolenikov, 2010; @@ -141,14 +149,15 @@

    Tools for Survey Statistics in Educational Assessment

    The package development was supported by BIFIE (Federal Institute for Educational Research, Innovation and Development of the Austrian School System; Salzburg, Austria).

    -
    - + +

    Details

    -

    The BIFIEsurvey package include basic descriptive functions for large scale assessment data + +

    The BIFIEsurvey package include basic descriptive functions for large scale assessment data to complement the more comprehensive survey package. The functions in this package were written in Rcpp.

    The features of BIFIEsurvey include for designs with replicate weights @@ -168,7 +177,8 @@

    Details replicated statistics

  • User-defined R functions (BIFIE.by)

  • - + +

    References

    Bruneforth, M., Oberwimmer, K., & Robitzsch, A. (2016). Reporting und Analysen. @@ -188,20 +198,17 @@

    R Grundlagen der oesterreichischen Bildungsstandardueberpruefung (S. 259-293). Wien: facultas.

    Shao, J. (1996). Invited discussion paper: Resampling methods in sample surveys. Statistics, 27(3-4), 203-237.

    -

    See also

    See also the survey, intsvy, svyPVpack, EdSurvey, lavaan.survey, EVER and the eatRep (https://r-forge.r-project.org/R/?group_id=1326) packages.

    -

    Examples

    -
    # NOT RUN {
    -##   |-----------------------------------------------------------------
    +    
    ##   |-----------------------------------------------------------------
     ##   | BIFIEsurvey 0.1-21 (2014-06-21)
    -##   | Maintainer: Alexander Robitzsch 
    +##   | Maintainer: Alexander Robitzsch <a.robitzsch at bifie.at >
     ##   | http://www.bifie.at
     ##   |-----------------------------------------------------------------
     
    @@ -232,42 +239,32 @@ 

    Examp ## ::::::::::::::::::::::. ,@######@. ####* ## @+ *#####@## ## ::::::::::::::::::::.* * .*##*. * *** *. ** ;##+;. -# }

    - +
    -

    Site built with pkgdown 1.3.0.

    +

    Site built with pkgdown 1.5.1.

    +
    + + diff --git a/docs/reference/BIFIEsurvey-utilities.html b/docs/reference/BIFIEsurvey-utilities.html index 5d8ce3a..b8839bc 100644 --- a/docs/reference/BIFIEsurvey-utilities.html +++ b/docs/reference/BIFIEsurvey-utilities.html @@ -8,21 +8,29 @@ Utility Functions in <span class="pkg">BIFIEsurvey</span> — BIFIEsurvey-utilities • BIFIEsurvey + - + - + + + + - + + + - + + - + - - + + + @@ -30,10 +38,10 @@ -BIFIEsurvey — BIFIEsurvey-utilities" /> +BIFIEsurvey — BIFIEsurvey-utilities" /> - + @@ -47,9 +55,10 @@ + - +
    +
    @@ -105,9 +114,7 @@

    Utility Functions in BIFIEsurvey

    -

    Utility functions in BIFIEsurvey.

    -
    ## Rubin rules for combining multiple imputation estimates
    @@ -119,7 +126,7 @@ 

    Utility Functions in BIFIEsurvey

    ## statistical inference for nested multiple imputation BIFIE_NMI_inference_parameters( parsM, parsrepM, fayfac, RR, Nimp, Nimp_NMI, comp_cov=FALSE)
    - +

    Arguments

    @@ -172,31 +179,33 @@

    Arg

    Logical

    - -
    - + +
    -

    Site built with pkgdown 1.3.0.

    +

    Site built with pkgdown 1.5.1.

    +
    + + diff --git a/docs/reference/bifietable.html b/docs/reference/bifietable.html index eb7db6e..5545cc9 100644 --- a/docs/reference/bifietable.html +++ b/docs/reference/bifietable.html @@ -8,21 +8,29 @@ An <span class="pkg">Rcpp</span> Based Version of the <code>table</code> Function — bifietable • BIFIEsurvey + - + - + + - + + + + + - + + - + - - + + + @@ -30,11 +38,11 @@ -Rcpp Based Version of the table Function — bifietable" /> +Rcpp Based Version of the table Function — bifietable" /> - + @@ -48,9 +56,10 @@ + - +
    +
    @@ -106,14 +115,12 @@

    An Rcpp Based Version of the table Fun

    -

    This is an Rcpp based version of the -base::table function.

    - +base::table function.

    bifietable(vec, sort.names=FALSE)
    - +

    Arguments

    @@ -127,51 +134,43 @@

    Arg character vector should also be sorted in the table output

    - +

    Value

    -

    Same output like base::table

    - +

    Same output like base::table

    See also

    - - +

    Examples

    -
    # NOT RUN {
    -data(data.timss1)
    -table( data.timss1[[1]][,"books"] )
    -BIFIEsurvey::bifietable( data.timss1[[1]][,"books"] )
    -# }
    +
    data(data.timss1)
    +table( data.timss1[[1]][,"books"] )
    +BIFIEsurvey::bifietable( data.timss1[[1]][,"books"] )
    - +
    -

    Site built with pkgdown 1.3.0.

    +

    Site built with pkgdown 1.5.1.

    +
    + + diff --git a/docs/reference/data.bifie.html b/docs/reference/data.bifie.html index 1e10d97..80a0942 100644 --- a/docs/reference/data.bifie.html +++ b/docs/reference/data.bifie.html @@ -8,21 +8,29 @@ Example Datasets for the <span class="pkg">BIFIEsurvey</span> Package — data.bifie • BIFIEsurvey + - + - + + + + - + + + - + + - + - - + + + @@ -30,10 +38,10 @@ -BIFIEsurvey Package — data.bifie" /> +BIFIEsurvey Package — data.bifie" /> - + @@ -47,9 +55,10 @@ + - +
    +
    @@ -105,45 +114,46 @@

    Example Datasets for the BIFIEsurvey Package

    -

    Some example datasets.

    -
    -
    data(data.bifie01)
    - +
    data(data.bifie01)
    + +

    Format

    -
      + +
      • The dataset data.bifie01 contains data of 4th Grade Austrian students from the TIMSS 2011 study.

      - -
    - + +
    -

    Site built with pkgdown 1.3.0.

    +

    Site built with pkgdown 1.5.1.

    +
    + + diff --git a/docs/reference/data.pisaNLD.html b/docs/reference/data.pisaNLD.html index 27f1eeb..912d496 100644 --- a/docs/reference/data.pisaNLD.html +++ b/docs/reference/data.pisaNLD.html @@ -8,21 +8,29 @@ Some PISA Datasets — data.pisaNLD • BIFIEsurvey + - + - + + + + - + + + - + + - + - - + + + @@ -30,10 +38,10 @@ - + - + @@ -47,9 +55,10 @@ + - +
    +
    @@ -105,145 +114,139 @@

    Some PISA Datasets

    -

    Some PISA datasets.

    -
    -
    data(data.pisaNLD)
    - +
    data(data.pisaNLD)
    + +

    Format

    The dataset data.pisaNLD is a data frame with 3992 observations on 405 variables which is a part of the Dutch PISA 2006 data.

    -

    Source

    Downloaded from http://www.jstatsoft.org/v20/i05/

    -

    Examples

    -
    # NOT RUN {
    -library(mitools)
    -library(survey)
    -library(intsvy)
    +    
    if (FALSE) {
    +library(mitools)
    +library(survey)
    +library(intsvy)
     
     #############################################################################
     # EXAMPLE 1: Dutch PISA 2006 dataset
     #############################################################################
     
    -data(data.pisaNLD)
    +data(data.pisaNLD)
     data <- data.pisaNLD
     
     #--- Create object of class BIFIEdata
     
     # list variables with plausible values: These must be named
     # as pv1math, pv2math, ..., pv5math, ...
    -pv_vars <- toupper( c("math", "math1", "math2", "math3", "math4",
    +pv_vars <- toupper( c("math", "math1", "math2", "math3", "math4",
                  "read", "scie", "prob") )
     # create 5 datasets including different sets of plausible values
     dfr <- NULL
    -VV <- length(pv_vars)
    +VV <- length(pv_vars)
     Nimp <- 5           # number of plausible values
     for (vv in 1:VV){
           vv1 <- pv_vars[vv]
    -      ind.vv1 <- which( colnames(data) %in% paste0("PV", 1:Nimp, vv1) )
    -      dfr2 <- data.frame( "variable"=paste0("PV", vv1), "var_index"=vv,
    +      ind.vv1 <- which( colnames(data) %in% paste0("PV", 1:Nimp, vv1) )
    +      dfr2 <- data.frame( "variable"=paste0("PV", vv1), "var_index"=vv,
               "data_index"=ind.vv1, "impdata_index"=1:Nimp )
    -      dfr <- rbind( dfr, dfr2 )
    +      dfr <- rbind( dfr, dfr2 )
     }
     
    -sel_ind <- setdiff( 1:( ncol(data) ), dfr$data_index )
    +sel_ind <- setdiff( 1:( ncol(data) ), dfr$data_index )
     data0 <- data[, sel_ind ]
    -V0 <- ncol(data0)
    -newvars <- seq( V0+1, V0+VV )
    -datalist <- as.list( 1:Nimp )
    +V0 <- ncol(data0)
    +newvars <- seq( V0+1, V0+VV )
    +datalist <- as.list( 1:Nimp )
     for (ii in 1:Nimp ){
    -    dat1 <- data.frame( data0, data[, dfr[ dfr$impdata_index==ii, "data_index" ]])
    -    colnames(dat1)[ newvars ] <- paste0("PV",pv_vars)
    +    dat1 <- data.frame( data0, data[, dfr[ dfr$impdata_index==ii, "data_index" ]])
    +    colnames(dat1)[ newvars ] <- paste0("PV",pv_vars)
         datalist[[ii]] <- dat1
     }
     
     # dataset with replicate weights
    -datarep <- data[, grep( "W_FSTR", colnames(data) ) ]
    -RR <- ncol(datarep)     # number of replicate weights
    +datarep <- data[, grep( "W_FSTR", colnames(data) ) ]
    +RR <- ncol(datarep)     # number of replicate weights
     
     # create BIFIE object
    -bifieobj <- BIFIEsurvey::BIFIE.data( datalist, wgt=data[, "W_FSTUWT"],
    +bifieobj <- BIFIEsurvey::BIFIE.data( datalist, wgt=data[, "W_FSTUWT"],
                      wgtrep=datarep, fayfac=1 / RR / ( 1 - .5 )^2 )
     # For PISA: RR=80 and therefore fayfac=1/20=.05
    -summary(bifieobj)
    +summary(bifieobj)
     
     #--- Create BIFIEdata object immediately using BIFIE.data.jack function
    -bifieobj1 <- BIFIEsurvey::BIFIE.data.jack( data.pisaNLD, jktype="RW_PISA", cdata=TRUE)
    -summary(bifieobj1)
    +bifieobj1 <- BIFIEsurvey::BIFIE.data.jack( data.pisaNLD, jktype="RW_PISA", cdata=TRUE)
    +summary(bifieobj1)
     
     #--- Create object in survey package
    -datL <- mitools::imputationList(list( datalist[[1]],datalist[[2]],
    +datL <- mitools::imputationList(list( datalist[[1]],datalist[[2]],
                       datalist[[3]],datalist[[4]],datalist[[5]]) )
    -pisades <- survey::svrepdesign(ids=~ 1, weights=~W_FSTUWT, data=datL,
    +pisades <- survey::svrepdesign(ids=~ 1, weights=~W_FSTUWT, data=datL,
                         repweights="W_FSTR[0-9]+", type="Fay", rho=0.5, mse=TRUE)
    -print(pisades)
    +print(pisades)
     
     #++++++++++++++ some comparisons with other packages +++++++++++++++++++++++++++++++
     
     #**** Model 1: Means for mathematics and reading
     # BIFIEsurvey package
    -mod1a <- BIFIEsurvey::BIFIE.univar( bifieobj, vars=c("PVMATH", "PVREAD") )
    -summary(mod1a)
    +mod1a <- BIFIEsurvey::BIFIE.univar( bifieobj, vars=c("PVMATH", "PVREAD") )
    +summary(mod1a)
     
     # intsvy package
    -mod1b <- intsvy::pisa.mean.pv(pvlabel="MATH", data=data.pisaNLD )
    +mod1b <- intsvy::pisa.mean.pv(pvlabel="MATH", data=data.pisaNLD )
     mod1b
     
     # survey package
    -mod1c <- with( pisades, survey::svymean(PVMATH~1, design=pisades) )
    -res1c <- mitools::MIcombine(mod1c)
    -summary(res1c)
    +mod1c <- with( pisades, survey::svymean(PVMATH~1, design=pisades) )
    +res1c <- mitools::MIcombine(mod1c)
    +summary(res1c)
     
     #**** Model 2: Linear regression
     # BIFIEsurvey package
    -mod2a <- BIFIEsurvey::BIFIE.linreg( bifieobj, dep="PVMATH",
    -              pre=c("one","ANXMAT","HISEI"))
    -summary(mod2a)
    +mod2a <- BIFIEsurvey::BIFIE.linreg( bifieobj, dep="PVMATH",
    +              pre=c("one","ANXMAT","HISEI"))
    +summary(mod2a)
     
     # intsvy package
    -mod2b <- intsvy::pisa.reg.pv(pvlabel="MATH", x=c("ANXMAT","HISEI"), data=data.pisaNLD)
    +mod2b <- intsvy::pisa.reg.pv(pvlabel="MATH", x=c("ANXMAT","HISEI"), data=data.pisaNLD)
     mod2b
     
     # survey package
    -mod2c <- with( pisades, survey::svyglm(PVMATH~ANXMAT+HISEI, design=pisades) )
    -res2c <- mitools::MIcombine(mod2c)
    -summary(res2c)
    -# }
    +mod2c <- with( pisades, survey::svyglm(PVMATH~ANXMAT+HISEI, design=pisades) ) +res2c <- mitools::MIcombine(mod2c) +summary(res2c) +}
    - +
    -

    Site built with pkgdown 1.3.0.

    +

    Site built with pkgdown 1.5.1.

    +
    + + diff --git a/docs/reference/data.test1.html b/docs/reference/data.test1.html index 5c5dd30..1b35c97 100644 --- a/docs/reference/data.test1.html +++ b/docs/reference/data.test1.html @@ -8,21 +8,29 @@ Some Datasets for Testing Purposes — data.test1 • BIFIEsurvey + - + - + + + + - + + + - + + - + - - + + + @@ -30,10 +38,10 @@ - + - + @@ -47,9 +55,10 @@ + - +
    +
    @@ -105,13 +114,12 @@

    Some Datasets for Testing Purposes

    -

    Some datasets for testing purposes.

    -
    -
    data(data.test1)
    - +
    data(data.test1)
    + +

    Format

    The dataset data.test1 is a dataset with a stratified clustered sample of @@ -133,32 +141,32 @@

    Format $ wgtstud: num 20.9 20.9 20.9 20.9 20.9 ...
    $ jkzone : num 101 101 101 101 101 101 101 101 101 101 ...
    $ jkrep : num 0 0 0 0 0 0 0 0 0 0 ...

    -

    - +
    -

    Site built with pkgdown 1.3.0.

    +

    Site built with pkgdown 1.5.1.

    +
    + + diff --git a/docs/reference/data.timss1.html b/docs/reference/data.timss1.html index 4fdf65a..4470de5 100644 --- a/docs/reference/data.timss1.html +++ b/docs/reference/data.timss1.html @@ -8,21 +8,29 @@ Dataset TIMSS 2011 — data.timss • BIFIEsurvey + - + - + + + + - + + + - + + - + - - + + + @@ -30,10 +38,10 @@ - + - + @@ -47,9 +55,10 @@ + - +
    +
    @@ -105,18 +114,17 @@

    Dataset TIMSS 2011

    -

    Example dataset TIMSS 2011

    -
    -
    data(data.timss1)
    -data(data.timss1.ind)
    -data(data.timss2)
    -data(data.timssrep)
    -data(data.timss3)
    -data(data.timss4)
    - +
    data(data.timss1)
    +data(data.timss1.ind)
    +data(data.timss2)
    +data(data.timssrep)
    +data(data.timss3)
    +data(data.timss4)
    + +

    Format

    The dataset data.timss1 is a list containing 5 imputed datasets. @@ -129,83 +137,82 @@

    Format

    The dataset data.timss4 is a list containing nested multiply imputed datasets, with 5 between-nest and 4 within-nest imputations.

    -

    Examples

    -
    # NOT RUN {
    -library(survey)
    -library(lavaan.survey)
    -library(intsvy)
    -library(mitools)
    +    
    if (FALSE) {
    +library(survey)
    +library(lavaan.survey)
    +library(intsvy)
    +library(mitools)
     
     #############################################################################
     # EXAMPLE 1: TIMSS dataset data.timss3 (one dataset including all PVs)
     #############################################################################
     
    -data(data.timss2)
    -data(data.timss3)
    -data(data.timssrep)
    +data(data.timss2)
    +data(data.timss3)
    +data(data.timssrep)
     
     # Analysis based on official 'single' datasets (data.timss3)
     # There are 5 plausible values, but student covariates are not imputed.
     
     #--- create object of class BIFIE data
    -bdat3 <- BIFIEsurvey::BIFIE.data(data.timss3, wgt=data.timss3$TOTWGT,
    +bdat3 <- BIFIEsurvey::BIFIE.data(data.timss3, wgt=data.timss3$TOTWGT,
                   wgtrep=data.timssrep[,-1], fayfac=1)
    -summary(bdat3)
    +summary(bdat3)
     # This BIFIEdata object contains one dataset in which all
     # plausible values are included. This object can be used
     # in analysis without plausible values.
     # Equivalently, one can define bdat3 much simpler by
    -bdat3 <- BIFIEsurvey::BIFIE.data.jack(data.timss3, jktype="JK_TIMSS")
    -summary(bdat3)
    +bdat3 <- BIFIEsurvey::BIFIE.data.jack(data.timss3, jktype="JK_TIMSS")
    +summary(bdat3)
     
     #--- In the following, the object bdat4 is defined with 5 datasets
     # referring to 5 plausible values.
    -bdat4 <- BIFIEsurvey::BIFIE.data.jack(data.timss3, pv_vars=c("ASMMAT","ASSSCI"),
    +bdat4 <- BIFIEsurvey::BIFIE.data.jack(data.timss3, pv_vars=c("ASMMAT","ASSSCI"),
                    jktype="JK_TIMSS")
    -summary(bdat4)
    +summary(bdat4)
     
     #--- create object in survey package
    -dat3a <- as.data.frame( cbind( data.timss2[[1]], data.timssrep ) )
    -RR <- ncol(data.timssrep) - 1       # number of jackknife zones
    -svydes3 <- survey::svrepdesign(data=dat3a, weights=~TOTWGT, type="JKn",
    -                 repweights='w_fstr[0-9]', scale=1,  rscales=rep(1,RR), mse=TRUE)
    -summary(svydes3)
    +dat3a <- as.data.frame( cbind( data.timss2[[1]], data.timssrep ) )
    +RR <- ncol(data.timssrep) - 1       # number of jackknife zones
    +svydes3 <- survey::svrepdesign(data=dat3a, weights=~TOTWGT, type="JKn",
    +                 repweights='w_fstr[0-9]', scale=1,  rscales=rep(1,RR), mse=TRUE)
    +summary(svydes3)
     
     #--- create object with imputed datasets in survey
     datL <- data.timss2
     # include replicate weights in each dataset
     for (ii in 1:5){
         dat1 <- datL[[ii]]
    -    dat1 <- cbind(  dat1, data.timssrep[,-1] )
    +    dat1 <- cbind(  dat1, data.timssrep[,-1] )
         datL[[ii]] <- dat1
     }
    -datL <- mitools::imputationList(list( datL[[1]],datL[[2]],datL[[3]],datL[[4]],datL[[5]]))
    -svydes4 <- survey::svrepdesign(data=datL, weights=~TOTWGT, type="JKn",
    -                   repweights='w_fstr[0-9]', scale=1,  rscales=rep(1,RR), mse=TRUE)
    -summary(svydes4)
    +datL <- mitools::imputationList(list( datL[[1]],datL[[2]],datL[[3]],datL[[4]],datL[[5]]))
    +svydes4 <- survey::svrepdesign(data=datL, weights=~TOTWGT, type="JKn",
    +                   repweights='w_fstr[0-9]', scale=1,  rscales=rep(1,RR), mse=TRUE)
    +summary(svydes4)
     
     #--- reconstruct data.timss3 for intsvy package. Plausible values must be labeled
     # as PV01, PV02, ... and NOT PV1, PV2, ...
     data.timss3a <- data.timss3
    -colnames(data.timss3a) <- gsub( "ASMMAT", "ASMMAT0", colnames(data.timss3a) )
    -colnames(data.timss3a) <- gsub( "ASSSCI", "ASSSCI0", colnames(data.timss3a) )
    +colnames(data.timss3a) <- gsub( "ASMMAT", "ASMMAT0", colnames(data.timss3a) )
    +colnames(data.timss3a) <- gsub( "ASSSCI", "ASSSCI0", colnames(data.timss3a) )
     
     #***************************
     # Model 1: Linear regression (no grouping variable)
     
     #--- linear regression in survey
    -mod1a <-  survey::svyglm( scsci ~ migrant + books, design=svydes3)
    -summary(mod1a)
    +mod1a <-  survey::svyglm( scsci ~ migrant + books, design=svydes3)
    +summary(mod1a)
     
     #--- regression with pirls.reg (intsvy)
    -mod1b <- intsvy::pirls.reg( y="scsci", x=c("migrant", "books" ), data=data.timss3)
    +mod1b <- intsvy::pirls.reg( y="scsci", x=c("migrant", "books" ), data=data.timss3)
     mod1b
     
     #---- regression with BIFIEsurvey
    -mod1c <- BIFIEsurvey::BIFIE.linreg( bdat3, dep="scsci", pre=c("one","migrant","books"))
    -summary(mod1c)
    +mod1c <- BIFIEsurvey::BIFIE.linreg( bdat3, dep="scsci", pre=c("one","migrant","books"))
    +summary(mod1c)
     
     #--- regression with lavaan.survey package
     lavmodel <- "
    @@ -214,30 +221,30 @@ 

    Examp scsci ~~ scsci " # fit in lavaan -lavaan.fit <- lavaan::lavaan( lavmodel, data=data.timss3, estimator="MLM") -summary(lavaan.fit) +lavaan.fit <- lavaan::lavaan( lavmodel, data=data.timss3, estimator="MLM") +summary(lavaan.fit) # using all replicated weights -mod1d <- lavaan.survey::lavaan.survey(lavaan.fit=lavaan.fit, survey.design=svydes3 ) -summary(mod1d) +mod1d <- lavaan.survey::lavaan.survey(lavaan.fit=lavaan.fit, survey.design=svydes3 ) +summary(mod1d) #*************************** # Model 2: Linear regression (grouped by female) #--- linear regression in survey -mod2a <- survey::svyglm( scsci ~ 0 + as.factor(female) + as.factor(female):migrant - + as.factor(female):books, design=svydes3) -summary(mod2a) +mod2a <- survey::svyglm( scsci ~ 0 + as.factor(female) + as.factor(female):migrant + + as.factor(female):books, design=svydes3) +summary(mod2a) #--- regression with pirls.reg (intsvy) -mod2b <- intsvy::pirls.reg( y="scsci", x=c("migrant", "books" ), +mod2b <- intsvy::pirls.reg( y="scsci", x=c("migrant", "books" ), by="female", data=data.timss3) mod2b[["0"]] # regression coefficients female=0 mod2b[["1"]] # regression coefficients female=1 #--- regression with BIFIEsurvey -mod2c <- BIFIEsurvey::BIFIE.linreg( bdat3, dep="scsci", - pre=c("one","migrant","books"), group="female") -summary(mod2c) +mod2c <- BIFIEsurvey::BIFIE.linreg( bdat3, dep="scsci", + pre=c("one","migrant","books"), group="female") +summary(mod2c) #--- regression with lavaan.survey package lavmodel <- " @@ -246,27 +253,27 @@

    Examp scsci ~~ scsci " # fit in lavaan -lavaan.fit <- lavaan::lavaan( lavmodel, data=data.timss3, group="female", estimator="MLM") -summary(lavaan.fit) -mod2d <- lavaan.survey::lavaan.survey(lavaan.fit=lavaan.fit, survey.design=svydes3 ) -summary(mod2d) +lavaan.fit <- lavaan::lavaan( lavmodel, data=data.timss3, group="female", estimator="MLM") +summary(lavaan.fit) +mod2d <- lavaan.survey::lavaan.survey(lavaan.fit=lavaan.fit, survey.design=svydes3 ) +summary(mod2d) #*************************** # Model 3: Linear regression with mathematics PVs -library(mitools) +library(mitools) #--- linear regression in survey -mod3a <- with(svydes4, survey::svyglm( ASMMAT ~ migrant + books, design=svydes4 ) ) -res3a <- mitools::MIcombine(mod3a) -summary(res3a) +mod3a <- with(svydes4, survey::svyglm( ASMMAT ~ migrant + books, design=svydes4 ) ) +res3a <- mitools::MIcombine(mod3a) +summary(res3a) #--- regression with pirls.reg.pv (intsvy) -mod3b <- intsvy::pirls.reg.pv( pvlabel="ASMMAT", x=c("migrant", "books" ), +mod3b <- intsvy::pirls.reg.pv( pvlabel="ASMMAT", x=c("migrant", "books" ), data=data.timss3a) #--- regression with BIFIEsurvey -mod3c <- BIFIEsurvey::BIFIE.linreg( bdat4, dep="ASMMAT", pre=c("one","migrant","books")) -summary(mod3c) +mod3c <- BIFIEsurvey::BIFIE.linreg( bdat4, dep="ASMMAT", pre=c("one","migrant","books")) +summary(mod3c) #--- regression with lavaan.survey package lavmodel <- " @@ -275,57 +282,56 @@

    Examp ASMMAT ~~ ASMMAT " # fit in lavaan -lavaan.fit <- lavaan::lavaan( lavmodel, data=data.timss3a, group="female", estimator="MLM") -summary(lavaan.fit) -mod3d <- lavaan.survey::lavaan.survey(lavaan.fit=lavaan.fit, survey.design=svydes4 ) -summary(mod3d) +lavaan.fit <- lavaan::lavaan( lavmodel, data=data.timss3a, group="female", estimator="MLM") +summary(lavaan.fit) +mod3d <- lavaan.survey::lavaan.survey(lavaan.fit=lavaan.fit, survey.design=svydes4 ) +summary(mod3d) ############################################################################# # EXAMPLE 2: TIMSS dataset data.timss4 | Nested multiply imputed dataset ############################################################################# -data(data.timss4) -data(data.timssrep) +data(data.timss4) +data(data.timssrep) #**** create BIFIEdata object -bdat <- BIFIEsurvey::BIFIE.data( data.list=data.timss4, wgt=data.timss4[[1]][[1]]$TOTWGT, +bdat <- BIFIEsurvey::BIFIE.data( data.list=data.timss4, wgt=data.timss4[[1]][[1]]$TOTWGT, wgtrep=data.timssrep[, -1 ], NMI=TRUE, cdata=TRUE ) -summary(bdat) +summary(bdat) #**** Model 1: Linear regression for mathematics score -mod1 <- BIFIEsurvey::BIFIE.linreg( bdat, dep="ASMMAT", pre=c("one","books","migrant")) -summary(mod1) +mod1 <- BIFIEsurvey::BIFIE.linreg( bdat, dep="ASMMAT", pre=c("one","books","migrant")) +summary(mod1) #*** Model 2: Univariate statistics ?BIFIEsurvey::BIFIE.univar -mod2 <- BIFIEsurvey::BIFIE.univar( bdat, vars=c("ASMMAT","ASSSCI","books") ) -summary(mod2) -# }

    +mod2 <- BIFIEsurvey::BIFIE.univar( bdat, vars=c("ASMMAT","ASSSCI","books") ) +summary(mod2) +}
    - +
    -

    Site built with pkgdown 1.3.0.

    +

    Site built with pkgdown 1.5.1.

    +
    + + diff --git a/docs/reference/index.html b/docs/reference/index.html index 4861234..262492a 100644 --- a/docs/reference/index.html +++ b/docs/reference/index.html @@ -8,21 +8,29 @@ Function reference • BIFIEsurvey + - + - + + + + - + + + - + + - + - - + + + @@ -30,10 +38,12 @@ + + @@ -44,9 +54,10 @@ + - +
    +
    @@ -114,6 +125,11 @@

    + + + + + @@ -153,21 +169,21 @@

    BIFIEdata.select()

    +

    BIFIE.data() summary(<BIFIEdata>) print(<BIFIEdata>)

    -

    Selection of Variables and Imputed Datasets for Objects of Class BIFIEdata

    +

    Creates an Object of Class BIFIEdata

    -

    BIFIE.data.transform()

    +

    BIFIEdata.select()

    -

    Data Transformation for BIFIEdata Objects

    +

    Selection of Variables and Imputed Datasets for Objects of Class BIFIEdata

    -

    BIFIE.data() summary(<BIFIEdata>) print(<BIFIEdata>)

    +

    BIFIE.data.transform()

    -

    Creates an Object of Class BIFIEdata

    +

    Data Transformation for BIFIEdata Objects

    @@ -231,15 +247,15 @@

    BIFIE.univar.test() summary(<BIFIE.univar.test>)

    +

    BIFIE.univar() summary(<BIFIE.univar>) coef(<BIFIE.univar>) vcov(<BIFIE.univar>)

    -

    Analysis of Variance and Effect Sizes for Univariate Statistics

    +

    Univariate Descriptive Statistics (Means and Standard Deviations)

    -

    BIFIE.univar() summary(<BIFIE.univar>) coef(<BIFIE.univar>) vcov(<BIFIE.univar>)

    +

    BIFIE.univar.test() summary(<BIFIE.univar.test>)

    -

    Univariate Descriptive Statistics (Means and Standard Deviations)

    +

    Analysis of Variance and Effect Sizes for Univariate Statistics

    @@ -312,27 +328,30 @@

    -

    Contents

    -
    +

    +
    -

    Site built with pkgdown 1.3.0.

    +

    Site built with pkgdown 1.5.1.

    +
    + + diff --git a/docs/reference/save.BIFIEdata.html b/docs/reference/save.BIFIEdata.html index 2fef7c3..3e2a52a 100644 --- a/docs/reference/save.BIFIEdata.html +++ b/docs/reference/save.BIFIEdata.html @@ -8,21 +8,29 @@ Saving, Writing and Loading <code>BIFIEdata</code> Objects — save.BIFIEdata • BIFIEsurvey + - + - + + - + + + + + - + + - + - - + + + @@ -30,14 +38,14 @@ - + - + @@ -51,9 +59,10 @@ + - +
    +
    @@ -109,25 +118,23 @@

    Saving, Writing and Loading BIFIEdata Objects

    -

    These functions save (save.BIFIEdata), write (write.BIFIEdata) or load (load.BIFIEdata) objects of class BIFIEdata.

    The function load.BIFIEdata.files allows the creation of BIFIEdata objects by loading separate files of imputed datasets, replicate weights and a possible indicator dataset.

    -
    save.BIFIEdata(BIFIEdata, name.BIFIEdata, cdata=TRUE, varnames=NULL)
     
    -write.BIFIEdata( BIFIEdata, name.BIFIEdata, dir=getwd(), varnames=NULL,
    +write.BIFIEdata( BIFIEdata, name.BIFIEdata, dir=getwd(), varnames=NULL,
         impdata.index=NULL, type="Rdata", ... )
     
    -load.BIFIEdata(filename, dir=getwd() )
    +load.BIFIEdata(filename, dir=getwd() )
     
     load.BIFIEdata.files( files.imp, wgt, file.wgtrep, file.ind=NULL,
    -    type="Rdata",varnames=NULL, cdata=TRUE, dir=getwd(), ... )
    - + type="Rdata",varnames=NULL, cdata=TRUE, dir=getwd(), ... ) +

    Arguments

    @@ -161,23 +168,23 @@

    Arg

    + sjlabelled::write_spss for writing sav files).

    - + + base::save, + utils::write.csv, + utils::write.csv2, + utils::write.table, + foreign::read.spss, + sjlabelled::write_spss

    @@ -200,200 +207,42 @@

    Arg

    type

    Type of saved data. Options are Rdata (function - base::save, - csv (function utils::write.csv), - csv2 (function utils::write.csv2), - table (function utils::write.table), - sav (function foreign::read.spss + base::save, + csv (function utils::write.csv), + csv2 (function utils::write.csv2), + table (function utils::write.table), + sav (function foreign::read.spss for reading sav files and function - sjlabelled::write_spss for writing sav files).

    ...

    Additional arguments to be passed to - base::save, - utils::write.csv, - utils::write.csv2, - utils::write.table, - foreign::read.spss, - sjlabelled::write_spss

    filename

    Optional. File name for dataset with response data indicators

    - +

    Value

    Saved R object and a summary in working directory or a loaded R object.

    -

    See also

    For creating objects of class BIFIEdata see BIFIE.data.

    -

    base::save, base::load

    - +

    base::save, base::load

    Examples

    -
    # NOT RUN {
    -#############################################################################
    -# EXAMPLE 1: Saving and loading BIFIE data objects
    -#############################################################################
    -data(data.timss1)
    -data(data.timssrep)
    -
    -bifieobj <- BIFIEsurvey::BIFIE.data( data.list=data.timss1, wgt=data.timss1[[1]]$TOTWGT,
    -                 wgtrep=data.timssrep[, -1 ] )
    -summary(bifieobj)
    -
    -# save bifieobj in a compact way
    -BIFIEsurvey::save.BIFIEdata( BIFIEdata=bifieobj, name.BIFIEdata="timss1_cdata" )
    -# save bifieobj in a non-compact way
    -BIFIEsurvey::save.BIFIEdata( BIFIEdata=bifieobj, name.BIFIEdata="timss1_data", cdata=FALSE)
    -
    -# load this object with object name "bdat2"
    -bdat2 <- BIFIEsurvey::load.BIFIEdata( filename="timss1_data.Rdata" )
    -summary(bdat2)
    -
    -# save bifieobj with selected variables
    -BIFIEsurvey::save.BIFIEdata( bifieobj, name.BIFIEdata="timss1_selectvars_cdata",
    -                     varnames=bifieobj$varnames[ c(1:7,13,12,9) ] )
    -# the same object, but use the non-compact way of saving
    -BIFIEsurvey::save.BIFIEdata( bifieobj, name.BIFIEdata="timss1_selectvars_data", cdata=FALSE,
    -                     varnames=bifieobj$varnames[ c(1:7,13,12,9) ] )
    -
    -# load object timss1_cdata (in compact data format)
    -bdat3 <- BIFIEsurvey::load.BIFIEdata( filename="timss1_cdata.Rdata" )
    -summary(bdat3)
    -# save selected variables of object bdat3
    -BIFIEsurvey::save.BIFIEdata( bdat3, name.BIFIEdata="timss1_selectvars2_cdata",
    -                     varnames=bifieobj$varnames[ c(1:4,12,8) ] )
    -
    -#############################################################################
    -# EXAMPLE 2: Writing BIFIEdata objects
    -#############################################################################
    -
    -data(data.timss2)
    -data(data.timssrep)
    -
    -# create compactBIFIEdata
    -bifieobj <- BIFIEsurvey::BIFIE.data( data.list=data.timss2, wgt=data.timss2[[1]]$TOTWGT,
    -                wgtrep=data.timssrep[, -1 ], cdata=TRUE)
    -summary(bifieobj)
    -
    -# save imputed datasets in format csv2
    -BIFIEsurvey::write.BIFIEdata( bifieobj, name.BIFIEdata="timss2_save1", type="csv2", row.names=FALSE)
    -
    -# save imputed datasets of BIFIEdata object in format table without column names
    -# and code missings as "."
    -BIFIEsurvey::write.BIFIEdata( bifieobj, name.BIFIEdata="timss2_save2", type="table",
    -                  col.names=FALSE, row.names=FALSE, na="." )
    -
    -# save imputed datasets of  BIFIEdata object in format csv and select some variables
    -# and only the first three datasets
    -varnames <- c("IDSTUD","TOTWGT","female","books","lang","ASMMAT")
    -BIFIEsurvey::write.BIFIEdata( bifieobj, name.BIFIEdata="timss2_save3", type="csv",
    -                   impdata.index=1:3, varnames=varnames)
    -
    -# save imputed datasets of BIFIEdata object in format Rdata, the R binary format
    -BIFIEsurvey::write.BIFIEdata( bifieobj, name.BIFIEdata="timss2_save4", type="Rdata"  )
    -
    -# save imputed datasets in sav (SPSS) format
    -BIFIEsurvey::write.BIFIEdata( bifieobj, name.BIFIEdata="timss2_save5", type="sav" )
    -
    -#############################################################################
    -# EXAMPLE 3: Loading BIFIEdata objects saved in separate files
    -#                   (no indicator dataset)
    -#############################################################################
    -
    -# We assume that Example 2 is applied and we build on the saved files
    -# from this example.
    -
    -#***--- read Rdata format
    -# extract files with imputed datasets and replicate weights
    -files.imp <- miceadds::grep.vec( c("timss2_save4__IMP", ".Rdata" ),
    -            list.files(getwd())  )$x
    -file.wgtrep <- miceadds::grep.vec( c("timss2_save4__WGTREP", ".Rdata" ),
    -            list.files(getwd())  )$x
    -# select some variables in varnames
    -varnames <- scan( nlines=1, what="character")
    -   IDSTUD   TOTWGT books lang migrant likesc  ASMMAT
    -
    -# load files and create BIFIEdata object
    -bifieobj1 <- BIFIEsurvey::load.BIFIEdata.files( files.imp, wgt="TOTWGT", file.wgtrep,
    -                        type="Rdata", varnames=varnames )
    -summary(bifieobj1)
    -
    -#***--- read csv2 format
    -files.imp <- miceadds::grep.vec( c("timss2_save1__IMP", ".csv" ),
    -                        list.files(getwd()) )$x
    -file.wgtrep <- miceadds::grep.vec( c("timss2_save1__WGTREP", ".csv" ),
    -                        list.files(getwd()) )$x
    -bifieobj2 <- BIFIEsurvey::load.BIFIEdata.files( files.imp, wgt="TOTWGT",
    -                    file.wgtrep, type="csv2" )
    -summary(bifieobj2)
    -
    -#***--- read sav format
    -files.imp <- miceadds::grep.vec( c("timss2_save5__IMP", ".sav" ),
    -                        list.files(getwd()) )$x
    -file.wgtrep <- miceadds::grep.vec( c("timss2_save5__WGTREP", ".sav" ),
    -                        list.files(getwd()) )$x
    -bifieobj3 <- BIFIEsurvey::load.BIFIEdata.files( files.imp, wgt="TOTWGT",
    -                file.wgtrep, type="sav", to.data.frame=TRUE, use.value.labels=FALSE)
    -summary(bifieobj3)
    -
    -#############################################################################
    -# EXAMPLE 4: Loading BIFIEdata objects saved in separate files
    -#                   (with an indicator dataset)
    -#############################################################################
    -
    -data(data.timss1)
    -data(data.timss1.ind)
    -data(data.timssrep)
    -
    -# create BIFIEdata object at first
    -bifieobj <- BIFIEsurvey::BIFIE.data( data.list=data.timss1, wgt="TOTWGT",
    -            wgtrep=data.timssrep[, -1 ] )
    -summary(bifieobj)
    -
    -#--- save datasets for the purpose of the following example
    -write.BIFIEdata( BIFIEdata=bifieobj, name.BIFIEdata="timss1_ex", type="Rdata" )
    -# save indicator dataset
    -save( data.timss1.ind, file="timss1_ex__IND.Rdata" )
    -
    -# grep file names
    -files.imp <- miceadds::grep.vec( c("timss1_ex__IMP", ".Rdata" ),
    -                      list.files(getwd()) )$x
    -file.wgtrep <- miceadds::grep.vec( c("timss1_ex__WGTREP", ".Rdata" ),
    -                      list.files(getwd()) )$x
    -file.ind <- miceadds::grep.vec( c("timss1_ex__IND", ".Rdata" ),
    -                      list.files(getwd()) )$x
    -# define variables for selection
    -varnames <- c("IDSTUD","TOTWGT","female","books","lang","ASMMAT")
    -# read files using indicator dataset
    -bifieobj2 <- BIFIEsurvey::load.BIFIEdata.files( files.imp, wgt="TOTWGT",
    -                  file.wgtrep=file.wgtrep, file.ind=file.ind, type="Rdata",
    -                  varnames=varnames)
    -summary(bifieobj2)
    -
    -# read files without indicator dataset
    -bifieobj3 <- BIFIEsurvey::load.BIFIEdata.files( files.imp, wgt="TOTWGT",
    -                file.wgtrep=file.wgtrep, type="Rdata", varnames=varnames)
    -summary(bifieobj3)
    -
    -# compare some descriptive statistics
    -res2 <- BIFIEsurvey::BIFIE.univar( bifieobj2, vars=c("books", "ASMMAT", "lang") )
    -res3 <- BIFIEsurvey::BIFIE.univar( bifieobj3, vars=c("books", "ASMMAT", "lang") )
    -summary(res2)
    -summary(res3)
    -# }
    -
    +
    
       
    -  
     
    +
           
    -

    Site built with pkgdown 1.3.0.

    +

    Site built with pkgdown 1.5.1.

    +
    + + diff --git a/docs/reference/se.html b/docs/reference/se.html index 51ae35e..c96f14d 100644 --- a/docs/reference/se.html +++ b/docs/reference/se.html @@ -8,21 +8,29 @@ Standard Errors of Estimated Parameters — se • BIFIEsurvey + - + - + + - + + + + + - + + - + - - + + + @@ -30,10 +38,10 @@ - + - + @@ -47,9 +55,10 @@ + - +
    +
    @@ -105,13 +114,11 @@

    Standard Errors of Estimated Parameters

    -

    Outputs vector of standard errors of an estimated parameter vector.

    -
    se(object)
    - +

    Arguments

    @@ -120,61 +127,53 @@

    Arg

    Object for which S3 method vcov can be applied

    - +

    Value

    Vector

    -

    See also

    - - +

    Examples

    -
    # NOT RUN {
    -#############################################################################
    +    
    #############################################################################
     # EXAMPLE 1: Toy example with lm function
     #############################################################################
     
    -set.seed(906)
    +set.seed(906)
     N <- 100
    -x <- seq(0,1,length=N)
    -y <- .6*x + stats::rnorm(N, sd=1)
    -mod <- stats::lm( y ~ x )
    -coef(mod)
    -vcov(mod)
    +x <- seq(0,1,length=N)
    +y <- .6*x + stats::rnorm(N, sd=1)
    +mod <- stats::lm( y ~ x )
    +coef(mod)
    +vcov(mod)
     se(mod)
    -summary(mod)
    -# }
    +summary(mod)
    - +
    -

    Site built with pkgdown 1.3.0.

    +

    Site built with pkgdown 1.5.1.

    +
    + + diff --git a/inst/NEWS b/inst/NEWS index ff78a7f..9259a21 100644 --- a/inst/NEWS +++ b/inst/NEWS @@ -38,8 +38,9 @@ Development of the Austrian School System (BIFIE) Salzburg (Austria) https://www.bifie.at/ + Questions or suggestions about BIFIEsurvey should be sent to -robitzsch@ipn.uni-kiel.de +robitzsch@leibniz-ipn.de ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -51,10 +52,11 @@ CHANGELOG BIFIEsurvey -------------------------------------------------------------------------- -VERSIONS BIFIEsurvey 3.4 | 2019-06-12 | Last: BIFIEsurvey 3.4-1 +VERSIONS BIFIEsurvey 3.4 | 2020-07-24 | Last: BIFIEsurvey 3.4-3 -------------------------------------------------------------------------- -xxx * --- +FIXED * fixed numerical instabilities in BIFIE.logistreg() + (thanks to Franck Petrucci) DATA * --- EXAMP * --- diff --git a/src/RcppExports.cpp b/src/RcppExports.cpp index a61778d..0fdca77 100644 --- a/src/RcppExports.cpp +++ b/src/RcppExports.cpp @@ -1,10 +1,11 @@ +//// File Name: RcppExports.cpp +//// File Version: 3.004003 // Generated by using Rcpp::compileAttributes() -> do not edit by hand // Generator token: 10BE3573-1514-4C36-9D1C-5A225CD40393 #include -#include -using namespace Rcpp; +using namespace Rcpp; using namespace arma; // bifiesurvey_rcpp_jackknife_timss Rcpp::NumericMatrix bifiesurvey_rcpp_jackknife_timss(Rcpp::NumericVector wgt, Rcpp::NumericVector jkzone, Rcpp::NumericVector jkrep, int RR, double jkfac, Rcpp::NumericVector prbar); diff --git a/src/bifiesurvey_rcpp_logistreg.cpp b/src/bifiesurvey_rcpp_logistreg.cpp index d1a5a3a..850ca30 100644 --- a/src/bifiesurvey_rcpp_logistreg.cpp +++ b/src/bifiesurvey_rcpp_logistreg.cpp @@ -1,5 +1,5 @@ //// File Name: bifiesurvey_rcpp_logistreg.cpp -//// File Version: 0.23 +//// File Version: 0.25 #include @@ -28,6 +28,7 @@ Rcpp::List bifiesurvey_rcpp_logistreg_compute( Rcpp::NumericVector y, Rcpp::Nume int P=X.ncol(); double t1=0; double minval_logit = -15; // minimum value for logit computation + double eps1=1e-8; //*** create matrices in Armadillo // design matrix X @@ -71,11 +72,11 @@ Rcpp::List bifiesurvey_rcpp_logistreg_compute( Rcpp::NumericVector y, Rcpp::Nume if ( pred_logit(nn,0) < minval_logit ){ pred_logit(nn,0) = minval_logit; } - ypred(nn,0) = 1 / ( 1 + exp( - pred_logit(nn,0) ) ); + ypred(nn,0) = 1 / ( 1 + std::exp( - pred_logit(nn,0) ) ); } // calculate entries for A matrix and outcome z for (int nn=0;nn