/* See DeCarlo, L. T. (2003). Source monitoring and multivariate signal detection theory, */
/* with a model for selection. Journal of Mathematical Psychology, 47, 292-303 */
option title = "Pilot source data (DeCarlo, unpublished)";
option variance-covariance matrix;
dsn = source.dat;
/* The above gives the data file name, which is a text file in the form of individual records */
/* Note: group 1=pictures, 2=words, 3=new items */
define regressor set A1X1; var = (group==1);
define regressor set B1X1; var = (group==1);
define normal distribution; dim=2; name=u1; name=v1;
define regressor set A2X2; var = (group==2);
define regressor set B2X2; var = (group==2);
define normal distribution; dim=2; name=u2; name=v2;
define regressor set A3X3; var = (group==3);
define regressor set B3X3; var = (group==3);
define normal distribution; dim=2; name=u3; name=v3;
define vector ca; dim=3;
define vector cb; dim=3;
/* Next are three sets of ordered probit models with sample selection */
/* See the aML manual for a basic example of dichotomous models with selection */
ordered probit model;
  keep if (group==1);
  outcomes = y1-1 y1;
  thresholds = ca;
  model = regset A1X1 + res(draw=1, ref=u1);
ordered probit model;
  keep if (group==1 and y1>=3);
  outcomes = y2-1 y2;
  thresholds = cb;
  model = regset B1X1 + res(draw=1, ref=v1);
ordered probit model;
  keep if (group==2);
  outcomes = y1-1 y1;
  thresholds = ca;
  model = regset A2X2 + res(draw=1, ref=u2);
ordered probit model;
  keep if (group==2 and y1>=3);
  outcomes = y2-1 y2;
  thresholds = cb;
  model = regset B2X2 + res(draw=1, ref=v2);
ordered probit model;
  keep if (group==3);
  outcome = y1-1 y1;
  thresholds = ca;
  model = regset A3X3 + res(draw=1, ref=u3);
ordered probit model;
  keep if (group==3 and y1>=3);
  outcomes = y2-1 y2;
  thresholds = cb;
  model = regset B3X3 + res(draw=1, ref=v3);
starting values;
/* Starting values must follow (see the aML manual) */
/* Start with simple models and build up to the full model */