| pattL.fit {prefmod} | R Documentation |
Function to fit a pattern model for ratings/Likert items (transformed to paired comparisons) allowing for missing values using a CL approach.
pattL.fit(obj, nitems, formel = ~1, elim = ~1, resptype = "rating",
undec = FALSE, ia = FALSE, NItest = FALSE, pr.it = FALSE)
obj |
either a dataframe or the path/name of the datafile to be read. |
nitems |
the number of items |
formel |
the formula for subject covariates to fit different preference scales for the objects (see below). |
elim |
the formula for the subject covariates that specify the table
to be analysed. If ommitted and formel is not ~1 then
elim will be set to the highest interaction between all terms
contained in formel. If elim is specified, the terms
must be separated by the * operator. |
resptype |
is "rating" by default and is reserved for future usage.
Any other specification will not change the behaviour of pattL.fit
|
undec |
for paired comparisons with a undecided/neutral category,
a common parameter will be estimated if undec = TRUE. |
ia |
interaction parameters between comparisons that have one object
in common if ia = TRUE.
|
NItest |
separate estimation of object parameters for complete and
incomplete patterns if NItest = TRUE. Currently,
NItest is set to FALSE if subject covariates are specified.
|
pr.it |
a dot is printed at each iteration cycle if set to TRUE
|
Models including categorical subject covariates can be fitted using the
formel and elim arguments. formel specifies the
actual model to be fitted. For instance, if specified as
formel=~SEX different preference scale for the objects will be
estimated for males and females. For two or more covariates,
the operators + or * can be used to model main or interaction
effects, respectively. The operator : is not allowed. See also
formula.
The specification for elim follows the same rules as for
formel. However, elim specifies the basic contingency
table to be set up but does not specify any covariates to be fitted.
This is done using formel.
If, e.g., elim=~SEX but formel=~1,
then the table is set up as if SEX would be fitted but only one global
preference scale is computed. This feature
allows for the succesive fitting of nested models to enable the use of
deviance differences for model selection (see example below).
pattL.fit returns an object of class pattMod. The function
print (i.e., print.pattMod) can be used to
print the results and the function patt.worth to
produce a matrix of worth parameters. An object of class pattMod
is a list containing the following components:
|
main results of the fit like estimates (coefficients),
log likelihood of the model (ll), log likelihood of the saturated model
(fl), and the call |
result |
a list of results from the fitting routine (see Value of
nlm).
|
envList |
a list with further fit details like subject covariates
design structure covdesmat, paired comparison reponse pattern matrix
Y, etc. |
partsList |
a list of the basic data structures for each subgroup
defined by crossing all covariate levels and different missing value
patterns. Each element of partsList is again a list containing
counts, missing value pattern, the CL matrix represented as a vector, and
the specification of the covariates. Use str to inspect
the elements and see example below.
|
The responses have to be coded as consecutive integers starting with 1 (or 0).
The value of 1 (0) means highest ‘endorsement’ (agreement)
according to the underlying scale.
Missing values are coded as NA,
rows with less than 2 valid responses are removed from the fit
and a message is printed.
Optional subject covariates have to be specified such that the categories are represented by consecutive integers starting with 1. Rows with missing values for subject covariates are removed from the data and a message is printed. The leftmost columns in the data must be the rankings, optionally followed by columns for categorical subject covariates.
The data specified via obj are supplied using either a data frame
or a datafile in which case obj is a path/filename. The input
data file if specified must be a plain text file with variable names in
the first row as readable via the command read.table(datafilename,
header = TRUE).
For an example see issp2000 or the file issp2000.dat in
the package's data/ directory.
The size of the table to be analysed increases dramatically with the number of items. For ratings (Likert items) the number of paired comparison response categories is always three. The number of rows of the table to set up the design matrix is initially (2 * number of categories - 1) ^ (number of items), e.g., for six items with 5 response categories each this is 531441. A reasobale maximum number of items with five response categories to be analysed with pattern models is 7.
Reinhold Hatzinger
patt.design, pattPC.fit, pattR.fit
## fit only four items
data(music)
music4<-music[,c("jazz","blues","folk","rap")]
pattL.fit(music4, nitems=4)
## fit additional undecided effect
pattL.fit(music4, nitems=4, undec=TRUE)
## check for ignorable missing
pattL.fit(music4, nitems=4, undec=TRUE, NItest=TRUE)