make.ix.mat | R Documentation |
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.
make.ix.mat(data, xi = NULL, ...)
data |
a 5 column data.frame. The first column is the |
xi |
an integer indicating the number of stimulus levels tested. If this is NULL, it is determined from the maximum value in |
... |
Other arguments, not used for the moment. |
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.
A data.frame withn
rows and p
columns.
resp |
The |
stim.2–stim.p |
Columns 2 through |
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.
Kenneth Knoblauch
ix.mat2df
, mlds
, lik6pt
, glm
data(AutumnLab)
make.ix.mat(AutumnLab)
mlds(AutumnLab, c(1, seq(6, 30, 3)))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.