squared.error: Function for calculating the 'distance' between two...

Description Usage Arguments Details Value Examples

Description

This utility function calcuates the distance between the implied distribution of outcomes for a specific value of X and a specific variable, and the observed distribution of outcomes from the original data. The distance function being used is the sum of squared differences.

Usage

1
squared.error(X, variable)

Arguments

X

A real number. This is the number that is picking out one member of the family of probability functions that are consistent with the fitted logisitic model.

variable

A column name from the original data frame. This will be the variable one of whose values you are calculating the probability for.

Details

The real-valued X indexes a family of probability distributions for a given explanatory variable. By specifying a variable, the function implied.proportion can produce implied probabilities, and these are compared with the observed distribution for each outcome.

The purpose of this function is to have a function of X that we can seek to minimise. This is precisely what the recommend function does.

Value

The sum of the squared differences between the observed distribution of outcomes and the distribution of outcomes implied by your choice of X and variable of interest.

Examples

1
squared.error(-1.9,"gender")

sumitrahman/perfman documentation built on May 30, 2019, 8:37 p.m.