make.ix.mat: Create data.frame for Fitting Difference Scale by glm

Description Usage Arguments Details Value Note Author(s) See Also Examples

Description

make.ix.mat generates a n x p matrix from the n x 5 column data.frame storing the results of a difference scaling experiment, where p is the number of stimulus levels tested and n is the number of trials. The first column is the response (0 or 1), and the p - 1 succeeding columns code covariates for all but the first stimulus level, which is contrained to be 0. These columns take the value 0 unless the stimulus level was in the trial, in which case they take, in order, the values, 1, -1, -1, 1.

Usage

1

Arguments

data

a 5 column data.frame. The first column is the resp and the next 4 columns the index of the stimulus level, 1 to p, labelled S1-S4

xi

an integer indicating the number of stimulus levels tested. If this is NULL, it is determined from the maximum value in data.

...

Other arguments, not used for the moment.

Details

To fit a difference scale using mlds and method = “glm”, each stimulus level is treated as a covariate taking on the values 0, if it was not present in the trial, or -1 or 1, the latter two depending on the ordinal stimulus level within the trial. This is a helper function to transform the typical 5 column data.frame from a difference scaling experiment, indicating the response and the 4 stimulus levels, to one in the format described above. Matrices of this form can also be used as newdata for the predict method. This is exploited in the function like6pt. It is here that the argument xi is necessary since the data.frame for the first of the 6-point comparisons does not contain the highest level of the scale and so needs to be specified so that the data.frame conforms with that used to generate the ‘mlds’ object.

Value

A data.frame withn rows and p columns.

resp

The resp (0, 1) is coded in the first column. This could be logical, instead.

stim.2–stim.p

Columns 2 through p code the presence and absence of the stimulus on a trial. If the stimulus is present, then the value is -1 or 1 as a function of the contribution of the stimulus level to the decision variable.

Note

In the current parameterization, the coefficient of the initial stimulus level is constrained to 0. Thus, the column corresponding to this level is left-out of the data.frame. For trials in which this stimulus is present, the non-zero elements are (-1, -1, 1), in that order.

Author(s)

Kenneth Knoblauch

See Also

ix.mat2df, mlds, lik6pt, glm

Examples

1
2
3

MLDS documentation built on May 1, 2019, 6:50 p.m.