Home Reference Source
public class | source

Stevens

You can directly use an instance of this class. stevens_exp

Constructor Summary

Public Constructor
public

constructor(params: *)

Initializes a Stevens experiment object.

Member Summary

Public Members
public
public
public
public
public
public
public
public
public
public
public
public
public
public
public
public
public
public
public
public
public
public
public
public

Method Summary

Public Methods
public

Calculates exclusion criteria using standard deviation and variance.

public

Resets all relevant variables to now use the test version.

public

Determines whether the round can end or not.

public

Determines whether the current sub condition can end or not.

public

When called, will save aggregated trial data into a CSV.

public

When called, will save individual trial data into a CSV.

public

Will generate the distractor coordinates and save them to the instance.

public

generate_trial(type: *): *

Generates a Stevens object for use in the JsPsych timeline.

public

get_anchoring_value(estimated_mids: *): *

Calculates the anchoring value for the specified subcondition.

public

get_estimated_mids(subcondition_data: *): *

Retrieves the estimated midpoints of each trial for the subcondition.

public

get_last_trial(trial: *): *

Retrieves the last stevens trial depending on block_type for a given sub condition index.

public

get_standard_deviation(estimated_mids: *): *

Calculates the standard deviation for the specified subcondition.

public

handle_data_saving(trial: *)

Handles saving the relevant data on a given trial.

public

prepare_experiment(balancing_type: *)

Orders the input data according to balancing type and initializes the Stevens object's variables.

public

prepare_practice(dataset: *)

Creates the practice dataset by taking the first FOUR subconditions.

public

Sets the subcondition order for foundational range.

public

Updates the estimated correlation.

Public Constructors

public constructor(params: *) source

Initializes a Stevens experiment object.

Params:

NameTypeAttributeDescription
params *

{assoc array} Parameters passed from routing.

Public Members

public MAX_STEP_INTERVAL: number source

public PIXELS_PER_CM: * source

public adjusted_midpoint_matrix: {} source

public balancing_type: * source

public condition_group: * source

public condition_name: * source

public current_sub_condition_index: number source

public distractor_coordinates: string source

public experiment_conditions_constants: * source

public graph_type: * source

public input_count_array: * source

public left_coordinates: string source

public middle_coordinates: string source

public practice_end: boolean source

public practice_trial_data: {} source

public raw_constants: * source

public right_coordinates: string source

public round_end: boolean source

public sub_condition_order: *[] source

public sub_conditions_constants: * source

public subject_id: * source

public subject_initials: * source

public trial_data: string source

public trial_structure: * source

Public Methods

public calculate_exclusion_criteria(): * source

Calculates exclusion criteria using standard deviation and variance. Subcondition is flagged if:

  • Standard deviation > 0.2
  • Anchoring > 0.6

@ return HTML of subcondition data to print onto screen

Return:

*

public end_practice_experiment() source

Resets all relevant variables to now use the test version. (input_count_array, sub_conditions_constants, and current_sub_condition_index are shared variables between the practice and test trials).

This function is called once all the practice trials have run.

public end_round(): boolean source

Determines whether the round can end or not. A round can end ONLY if there has been at least 1 input from the user on the given round

Return:

boolean

True if sub condition should end.

public end_sub_condition(): boolean source

Determines whether the current sub condition can end or not.

Return:

boolean

True if sub condition should end.

public export_summary_data() source

When called, will save aggregated trial data into a CSV.

public export_trial_data() source

When called, will save individual trial data into a CSV.

public generate_distractor_coordinates(constants: object) source

Will generate the distractor coordinates and save them to the instance.

Params:

NameTypeAttributeDescription
constants object

(for the given trial)

public generate_trial(type: *): * source

Generates a Stevens object for use in the JsPsych timeline.

Params:

NameTypeAttributeDescription
type *

{string} "test" or "practice"

Return:

*

trial {object}

public get_anchoring_value(estimated_mids: *): * source

Calculates the anchoring value for the specified subcondition. @ param {array} array of estimated mids for that trial

@ return {double} anchoring value

Params:

NameTypeAttributeDescription
estimated_mids *

Return:

*

public get_estimated_mids(subcondition_data: *): * source

Retrieves the estimated midpoints of each trial for the subcondition.

@ return {array} of estimated mids

Params:

NameTypeAttributeDescription
subcondition_data *

Return:

*

public get_last_trial(trial: *): * source

Retrieves the last stevens trial depending on block_type for a given sub condition index. If this is the first trial of a given block_type, returns null.

Params:

NameTypeAttributeDescription
trial *

{object}
block_type {string} "test" or "practice"
index {integer}

Return:

*

last_stevens_trial {object}

public get_standard_deviation(estimated_mids: *): * source

Calculates the standard deviation for the specified subcondition. @ param {array} array of estimated mids for that trial

@ return {double} standard deviation

Params:

NameTypeAttributeDescription
estimated_mids *

Return:

*

public handle_data_saving(trial: *) source

Handles saving the relevant data on a given trial.

For reference, these are the helper variables created to assist in trial logic (i.e not present in excel) this.trial_variables =
{type: 'stevens', run_type: '', left_correlation: '', right_correlation: '', round_refreshes: 0, // Number of times there is a refresh for a given round high_ref_is_right: false start_ref: '' };

These are variables created WITHIN the trial logic that were not present in excel (but need to be outputted to results).
this.export_variables = {trial_num: 0, // Round index trial is currently on (aka trial_num from excel) sub_condition: '', // Chronological ordering of sub_condition [1, 2, 3 ... ] balanced_sub_condition: '', // Index of sub_condition according to balancing order estimated_mid: '', num_adjustments: 0, // Number of inputs for a given round (aka num_adjustments from excel) trials_per_round: '', };

Params:

NameTypeAttributeDescription
trial *

{object} block_type {string} "test" or "practice" constants {assoc array} estimated_correlation {double} last_stevens_trial {object} index {integer}

public prepare_experiment(balancing_type: *) source

Orders the input data according to balancing type and initializes the Stevens object's variables.

Params:

NameTypeAttributeDescription
balancing_type *

{string} Type of balancing. Currently only latin_square is supported. dataset {[{assoc array}, {assoc array}, ... ]} The data to be ordered.

public prepare_practice(dataset: *) source

Creates the practice dataset by taking the first FOUR subconditions.

Params:

NameTypeAttributeDescription
dataset *

{[{assoc array}, {assoc array}, ... ]} The data to be ordered.

public set_foundational_dataset_order(dataset: *) source

Sets the subcondition order for foundational range. Needs to balance INDIVIDUALLY the round and test type conditions, then maintain that order (e.g. all test goes first, then consistency)

Params:

NameTypeAttributeDescription
dataset *

{[{assoc array}, {assoc array}, ... ]} The data used to be ordered.

public update_estimated_correlation(trial: *): * source

Updates the estimated correlation. If : Is the first trial, will initialize the correlation and step size. Else: If there was a key press in previous trial, will calculate the the estimated correlation (depending on whether it was an inc or dec). Else if no key press in previous trial, will set estimated correlation to the previous trial's.

Params:

NameTypeAttributeDescription
trial *

{object}
constants {object}
last_trial {object}

Return:

*

estimated_correlation {double}