Package 'TSEwgt'

Title: Total Survey Error Under Multiple, Different Weighting Schemes
Description: Calculates total survey error (TSE) for a survey under multiple, different weighting schemes, using both scale-dependent and scale-independent metrics. Package works directly from the data set, with no hand calculations required: just upload a properly structured data set (see TESTWGT and its documentation), properly input column names (see functions documentation), and run your functions. For more on TSE, see: Weisberg, Herbert (2005, ISBN:0-226-89128-3); Biemer, Paul (2010) <doi:10.1093/poq/nfq058>; Biemer, Paul et.al. (2017, ISBN:9781119041672); etc.
Authors: Joshua Miller [aut, cre]
Maintainer: Joshua Miller <[email protected]>
License: GPL (>= 2)
Version: 0.1.0
Built: 2025-02-14 02:39:36 UTC
Source: https://github.com/cran/TSEwgt

Help Index


Average mean absolute error (aMAE)

Description

Calculates average mean absolute error (aMAE) under multiple, different weighting schemes

Usage

AVEMAEw(Actual = data.frame(), Survey = data.frame(),
  Weights = data.frame())

Arguments

Actual

data from a "gold standard" survey; objects are variable columns from "gold standard" survey that corruspond to variable columns Survey

Survey

data from a survey; objects are variable columns from a survey that corruspond to variable columns from Actual

Weights

weights to be applied to Survey data; objects are weights columns

Details

aMAE for weighting scheme # => mean value of the MAEs for specified variables under weighting scheme # => mean value of MAEs for objects in Survey=data.frame() * objects in Weights=data.frame()

Value

Average mean absolute error (aMAE) under multiple, different weighting schemes

Note

Make sure to properly order inputs, per the example: Actual=data.frame() objects and corrusponding Survey=data.frame() objects must be given in the same order as each other; and Weights=data.frame() objects must be given in sequence of weighting scheme #.

Examples

AVEMAEw(Actual=data.frame(TESTWGT$A1, TESTWGT$A2),
Survey=data.frame(TESTWGT$Q1, TESTWGT$Q2),
Weights=data.frame(TESTWGT$W1, TESTWGT$W2))

Average mean absolute percentage error (aMAPE)

Description

Calculates average mean absolute percentage error (aMAPE) under multiple, different weighting schemes

Usage

AVEMAPEw(Actual = data.frame(), Survey = data.frame(),
  Weights = data.frame())

Arguments

Actual

data from a "gold standard" survey; objects are variable columns from "gold standard" survey that corruspond to variable columns Survey

Survey

data from a survey; objects are variable columns from a survey that corruspond to variable columns from Actual

Weights

weights to be applied to Survey data; objects are weights columns

Details

aMAPE for weighting scheme # => mean value of the aMAPEs for specified variables under weighting scheme # => mean value of aMAPEs for objects in Survey=data.frame() * objects in Weights=data.frame()

Value

Average mean absolute percentage error (aMAPE) under multiple, different weighting schemes

Note

Make sure to properly order inputs, per the example: Actual=data.frame() objects and corrusponding Survey=data.frame() objects must be given in the same order as each other; and Weights=data.frame() objects must be given in sequence of weighting scheme #.

Examples

AVEMAPEw(Actual=data.frame(TESTWGT$A1, TESTWGT$A2),
Survey=data.frame(TESTWGT$Q1, TESTWGT$Q2),
Weights=data.frame(TESTWGT$W1, TESTWGT$W2))

Average mean squared error (aMSE) with bias-variance decomposition

Description

Calculates average mean squared error (aMSE) with bias-variance decomposition under multiple, different weighting schemes

Usage

AVEMSEw(Actual = data.frame(), Survey = data.frame(),
  Weights = data.frame())

Arguments

Actual

data from a "gold standard" survey; objects are variable columns from "gold standard" survey that corruspond to variable columns Survey

Survey

data from a survey; objects are variable columns from a survey that corruspond to variable columns from Actual

Weights

weights to be applied to Survey data; objects are weights columns

Details

aMSE for weighting scheme # => mean value of the MSEs for specified variables under weighting scheme # => mean value of MSEs for objects in Survey=data.frame() * objects in Weights=data.frame()

Value

Average mean squared error (aMSE) with bias-variance decomposition under multiple, different weighting schemes

Note

Make sure to properly order inputs, per the example: Actual=data.frame() objects and corrusponding Survey=data.frame() objects must be given in the same order as each other; and Weights=data.frame() objects must be given in sequence of weighting scheme #.

Examples

AVEMSEw(Actual=data.frame(TESTWGT$A1, TESTWGT$A2),
Survey=data.frame(TESTWGT$Q1, TESTWGT$Q2),
Weights=data.frame(TESTWGT$W1, TESTWGT$W2))

Average mean squared logarithmic error (aMSLE)

Description

Calculates average mean squared logarithmic error (aMSLE) under multiple, different weighting schemes

Usage

AVEMSLEw(Actual = data.frame(), Survey = data.frame(),
  Weights = data.frame())

Arguments

Actual

data from a "gold standard" survey; objects are variable columns from "gold standard" survey that corruspond to variable columns Survey

Survey

data from a survey; objects are variable columns from a survey that corruspond to variable columns from Actual

Weights

weights to be applied to Survey data; objects are weights columns

Details

aMSLE for weighting scheme # => mean value of the aMSLEs for specified variables under weighting scheme # => mean value of aMSLEs for objects in Survey=data.frame() * objects in Weights=data.frame()

Value

Average mean squared logarithmic error (aMSLE) under multiple, different weighting schemes

Note

Make sure to properly order inputs, per the example: Actual=data.frame() objects and corrusponding Survey=data.frame() objects must be given in the same order as each other; and Weights=data.frame() objects must be given in sequence of weighting scheme #.

Examples

AVEMSLEw(Actual=data.frame(TESTWGT$A1, TESTWGT$A2),
Survey=data.frame(TESTWGT$Q1, TESTWGT$Q2),
Weights=data.frame(TESTWGT$W1, TESTWGT$W2))

Average relative absolute error (aRAE)

Description

Calculates average relative absolute error (aRAE) under multiple, different weighting schemes

Usage

AVERAEw(Actual = data.frame(), Survey = data.frame(),
  Weights = data.frame())

Arguments

Actual

data from a "gold standard" survey; objects are variable columns from "gold standard" survey that corruspond to variable columns Survey

Survey

data from a survey; objects are variable columns from a survey that corruspond to variable columns from Actual

Weights

weights to be applied to Survey data; objects are weights columns

Details

aRAE for weighting scheme # => mean value of the aRAEs for specified variables under weighting scheme # => mean value of aRAEs for objects in Survey=data.frame() * objects in Weights=data.frame()

Value

Average relative absolute error (aRAE) under multiple, different weighting schemes

Note

Make sure to properly order inputs, per the example: Actual=data.frame() objects and corrusponding Survey=data.frame() objects must be given in the same order as each other; and Weights=data.frame() objects must be given in sequence of weighting scheme #.

Examples

AVERAEw(Actual=data.frame(TESTWGT$A1, TESTWGT$A2),
Survey=data.frame(TESTWGT$Q1, TESTWGT$Q2),
Weights=data.frame(TESTWGT$W1, TESTWGT$W2))

Average root mean squared error (aRMSE)

Description

Calculates average root mean squared error (aRMSE) under multiple, different weighting schemes

Usage

AVERMSEw(Actual = data.frame(), Survey = data.frame(),
  Weights = data.frame())

Arguments

Actual

data from a "gold standard" survey; objects are variable columns from "gold standard" survey that corruspond to variable columns Survey

Survey

data from a survey; objects are variable columns from a survey that corruspond to variable columns from Actual

Weights

weights to be applied to Survey data; objects are weights columns

Details

aRMSE for weighting scheme # => mean value of the RMSEs for specified variables under weighting scheme # => mean value of RMSEs for objects in Survey=data.frame() * objects in Weights=data.frame()

Value

Average root mean squared error (aRMSE) under multiple, different weighting schemes

Note

Make sure to properly order inputs, per the example: Actual=data.frame() objects and corrusponding Survey=data.frame() objects must be given in the same order as each other; and Weights=data.frame() objects must be given in sequence of weighting scheme #.

Examples

AVERMSEw(Actual=data.frame(TESTWGT$A1, TESTWGT$A2),
Survey=data.frame(TESTWGT$Q1, TESTWGT$Q2),
Weights=data.frame(TESTWGT$W1, TESTWGT$W2))

Average root mean squared logarithmic error (aRMSLE)

Description

Calculates average root mean squared logarithmic error (aRMSLE) under multiple, different weighting schemes

Usage

AVERMSLEw(Actual = data.frame(), Survey = data.frame(),
  Weights = data.frame())

Arguments

Actual

data from a "gold standard" survey; objects are variable columns from "gold standard" survey that corruspond to variable columns Survey

Survey

data from a survey; objects are variable columns from a survey that corruspond to variable columns from Actual

Weights

weights to be applied to Survey data; objects are weights columns

Details

aRMSLE for weighting scheme # => mean value of the aRMSLEs for specified variables under weighting scheme # => mean value of aRMSLEs for objects in Survey=data.frame() * objects in Weights=data.frame()

Value

Average root mean squared logarithmic error (aRMSLE) under multiple, different weighting schemes

Note

Make sure to properly order inputs, per the example: Actual=data.frame() objects and corrusponding Survey=data.frame() objects must be given in the same order as each other; and Weights=data.frame() objects must be given in sequence of weighting scheme #.

Examples

AVERMSLEw(Actual=data.frame(TESTWGT$A1, TESTWGT$A2),
Survey=data.frame(TESTWGT$Q1, TESTWGT$Q2),
Weights=data.frame(TESTWGT$W1, TESTWGT$W2))

Average root relative squared error (aRRSE)

Description

Calculates average root relative squared error (aRRSE) under multiple, different weighting schemes

Usage

AVERRSEw(Actual = data.frame(), Survey = data.frame(),
  Weights = data.frame())

Arguments

Actual

data from a "gold standard" survey; objects are variable columns from "gold standard" survey that corruspond to variable columns Survey

Survey

data from a survey; objects are variable columns from a survey that corruspond to variable columns from Actual

Weights

weights to be applied to Survey data; objects are weights columns

Details

aRRSE for weighting scheme # => mean value of the aRRSEs for specified variables under weighting scheme # => mean value of aRRSEs for objects in Survey=data.frame() * objects in Weights=data.frame()

Value

Average root relative squared error (aRRSE) under multiple, different weighting schemes

Note

Make sure to properly order inputs, per the example: Actual=data.frame() objects and corrusponding Survey=data.frame() objects must be given in the same order as each other; and Weights=data.frame() objects must be given in sequence of weighting scheme #.

Examples

AVERRSEw(Actual=data.frame(TESTWGT$A1, TESTWGT$A2),
Survey=data.frame(TESTWGT$Q1, TESTWGT$Q2),
Weights=data.frame(TESTWGT$W1, TESTWGT$W2))

Average relative squared error (aRSE)

Description

Calculates average relative squared error (aRSE) under multiple, different weighting schemes

Usage

AVERSEw(Actual = data.frame(), Survey = data.frame(),
  Weights = data.frame())

Arguments

Actual

data from a "gold standard" survey; objects are variable columns from "gold standard" survey that corruspond to variable columns Survey

Survey

data from a survey; objects are variable columns from a survey that corruspond to variable columns from Actual

Weights

weights to be applied to Survey data; objects are weights columns

Details

aRSE for weighting scheme # => mean value of the aRSEs for specified variables under weighting scheme # => mean value of aRSEs for objects in Survey=data.frame() * objects in Weights=data.frame()

Value

Average relative squared error (aRSE) under multiple, different weighting schemes

Note

Make sure to properly order inputs, per the example: Actual=data.frame() objects and corrusponding Survey=data.frame() objects must be given in the same order as each other; and Weights=data.frame() objects must be given in sequence of weighting scheme #.

Examples

AVERSEw(Actual=data.frame(TESTWGT$A1, TESTWGT$A2),
Survey=data.frame(TESTWGT$Q1, TESTWGT$Q2),
Weights=data.frame(TESTWGT$W1, TESTWGT$W2))

Average symmetric mean absolute percentage error (aSMAPE)

Description

Calculates average symmetric mean absolute percentage error (aSMAPE) under multiple, different weighting schemes

Usage

AVESMAPEw(Actual = data.frame(), Survey = data.frame(),
  Weights = data.frame())

Arguments

Actual

data from a "gold standard" survey; objects are variable columns from "gold standard" survey that corruspond to variable columns Survey

Survey

data from a survey; objects are variable columns from a survey that corruspond to variable columns from Actual

Weights

weights to be applied to Survey data; objects are weights columns

Details

aSMAPE for weighting scheme # => mean value of the aSMAPEs for specified variables under weighting scheme # => mean value of aSMAPEs for objects in Survey=data.frame() * objects in Weights=data.frame()

Value

Average symmetric mean absolute percentage error (aSMAPE) under multiple, different weighting schemes

Note

Make sure to properly order inputs, per the example: Actual=data.frame() objects and corrusponding Survey=data.frame() objects must be given in the same order as each other; and Weights=data.frame() objects must be given in sequence of weighting scheme #.

Examples

AVESMAPEw(Actual=data.frame(TESTWGT$A1, TESTWGT$A2),
Survey=data.frame(TESTWGT$Q1, TESTWGT$Q2),
Weights=data.frame(TESTWGT$W1, TESTWGT$W2))

Full scale-dependent statistics

Description

Calculates full scale-dependent statistics

Usage

FULLSDw(Actual = data.frame(), Survey = data.frame(),
  Weights = data.frame())

Arguments

Actual

data from a "gold standard" survey; objects are variable columns from "gold standard" survey that corruspond to variable columns Survey

Survey

data from a survey; objects are variable columns from a survey that corruspond to variable columns from Actual

Weights

weights to be applied to Survey data; objects are weights columns

Value

Full scale-dependent statistics

Note

Make sure to properly order inputs, per the example: Actual=data.frame() objects and corrusponding Survey=data.frame() objects must be given in the same order as each other; and Weights=data.frame() objects must be given in sequence of weighting scheme #.

Examples

FULLSDw(Actual=data.frame(TESTWGT$A1, TESTWGT$A2),
Survey=data.frame(TESTWGT$Q1, TESTWGT$Q2),
Weights=data.frame(TESTWGT$W1, TESTWGT$W2))

Full scale-independent statistics

Description

Calculates full scale-independent statistics

Usage

FULLSIw(Actual = data.frame(), Survey = data.frame(),
  Weights = data.frame())

Arguments

Actual

data from a "gold standard" survey; objects are variable columns from "gold standard" survey that corruspond to variable columns Survey

Survey

data from a survey; objects are variable columns from a survey that corruspond to variable columns from Actual

Weights

weights to be applied to Survey data; objects are weights columns

Value

Full scale-independent statistics

Note

Make sure to properly order inputs, per the example: Actual=data.frame() objects and corrusponding Survey=data.frame() objects must be given in the same order as each other; and Weights=data.frame() objects must be given in sequence of weighting scheme #.

Examples

FULLSIw(Actual=data.frame(TESTWGT$A1, TESTWGT$A2),
Survey=data.frame(TESTWGT$Q1, TESTWGT$Q2),
Weights=data.frame(TESTWGT$W1, TESTWGT$W2))

A data set created by merging 1) "actual" data from a "gold standard" survey (A1, A2), and 2) data from another survey (Q1, Q2), including weights columns for that data (W1, W2). A1/Q1 and A2/Q2 are responses to the same two questions, asked to the same 10 respondents (ID), along the same 1-99 response scale.

Description

A data set created by merging 1) "actual" data from a "gold standard" survey (A1, A2), and 2) data from another survey (Q1, Q2), including weights columns for that data (W1, W2). A1/Q1 and A2/Q2 are responses to the same two questions, asked to the same 10 respondents (ID), along the same 1-99 response scale.

Usage

TESTWGT

Format

A data frame with 10 rows and 7 variables

ID, A1, A2, Q1, Q2, W1, W2

Paired "actual"/survey data with weights columns for survey data

Source

Example data generated by author