Fitting a model when the parameters are not identifiable
For any ψ1 and ψ2, the covariance matrix is the same for all points on the circle defined by β12 + β22 = σ12, so the sum of squared estimated regression coefficients should be σ12-hat=0.96515, give or take the imprecision of numerical search.
/**************************** Circle.sas ****************************/
title 'Try to fit a non-identified model';
title2 'Jerry Brunner: Student Number 999999999';
data Bizarre;
infile '/folders/myfolders/431s17/Circle.data.txt' firstobs=2 ; /* Skipping the header */
input id Y1-Y4;
proc calis pshort nostand vardef=n pcorr;
title3 'True beta1 = 0.7071068, beta2 = -0.7071068, psi1 = psi2 = 1';
title4 'With psi1 neq psi2, fails parameter count rule';
var Y1 Y2; /* Declare observed variables */
lineqs
/* Latent variables must begin with F for Factor.
Error terms must begin with e or d (for disturbance) */
Y1 = beta1*F1 + beta2*F2 + epsilon1,
Y2 = beta1*F1 + beta2*F2 + epsilon2;
variance /* Declare variance parameters. */
epsilon1 = psi1, epsilon2 = psi2,
F1 = 1, F2 = 1;
cov
F1 F2 = 0;
/* Other unmentioned covariances are assumed zero. */
/* If no means or intercepts are given, model is assumed to
be in centered form. Unmentioned means and intercepts are
re-parameterized and disappear from the likelihood. */
proc calis pshort nostand vardef=n pcorr;
title3 'True beta1 = 0.7071068, beta2 = -0.7071068, psi1 = psi2 = 1';
title4 'Passes parameter count rule with psi1=psi1=psi';
var Y1 Y2; /* Declare observed variables */
lineqs
/* Latent variables must begin with F for Factor.
Error terms must begin with e or d (for disturbance) */
Y1 = beta1*F1 + beta2*F2 + epsilon1,
Y2 = beta1*F1 + beta2*F2 + epsilon2;
variance /* Declare variance parameters. */
epsilon1 = psi, epsilon2 = psi,
F1 = 1, F2 = 1;
cov
F1 F2 = 0;
proc calis pshort nostand vardef=n pcorr;
title3 'True beta1 = 0.7071068, beta2 = -0.7071068, psi1 = psi2 = 1';
title4 'Psi1 neq psi2 again, start at beta1 = -0.9824205, beta2=0';
var Y1 Y2; /* Declare observed variables */
lineqs
/* Latent variables must begin with F for Factor.
Error terms must begin with e or d (for disturbance) */
Y1 = beta1(-0.9824205)*F1 + beta2(0)*F2 + epsilon1,
Y2 = beta1(-0.9824205)*F1 + beta2(0)*F2 + epsilon2;
variance /* Declare variance parameters. */
epsilon1 = psi1(0.75731), epsilon2 = psi2(1.19528),
F1 = 1, F2 = 1;
cov
F1 F2 = 0;
proc calis pshort nostand vardef=n pcorr;
title3 'True beta1 = beta2 = 0, psi1 = psi2 = 1';
title4 'Fails parameter count rule';
var Y3 Y4; /* Declare observed variables */
lineqs
/* Latent variables must begin with F for Factor.
Error terms must begin with e or d (for disturbance) */
Y3 = beta1*F1 + beta2*F2 + epsilon1,
Y4 = beta1*F1 + beta2*F2 + epsilon2;
variance /* Declare variance parameters. */
epsilon1 = psi1, epsilon2 = psi2,
F1 = 1, F2 = 1;
cov
F1 F2 = 0;
title 'Metric Cars Data: Fit a regression model with proc calis';
title2 'Jerry Brunner: Student Number 999999999';
/* Numerical problems due to differneces in scale. */
data auto;
infile '/folders/myfolders/431s17/mcars4.data' firstobs=2 ; /* Skipping the header */
input id country $ lper100k weight length;
ods graphics off; /* Suppress regression plots */
proc reg;
title3 'Proc reg for comparison';
model lper100k = weight length;
proc calis pshort nostand vardef=n pcorr;
title3 'Surface regression with proc calis';
var lper100k weight length; /* Declare observed variables */
lineqs
lper100k = beta0*Intercept + beta1*weight + beta2*length + epsilon;
mean /* Declare non-zero mean parameters. */
weight = mu1, length = mu2;
variance /* Declare variance parameters. */
weight = phi11,
length = phi22,
epsilon = psi;
cov /* Declare non-zero covariance parameters. */
weight length = phi12;
data auto2;
set auto; /* Now auto2=auto */
weight = weight/100; /* Re-scale so weight is in hundreds of kg. */
proc calis pshort nostand vardef=n pcorr;
title3 'Weight re-scaled';
var lper100k weight length; /* Declare observed variables */
lineqs
lper100k = beta0*Intercept + beta1*weight + beta2*length + epsilon;
mean /* Declare non-zero mean parameters. */
weight = mu1, length = mu2;
variance /* Declare variance parameters. */
weight = phi11,
length = phi22,
epsilon = psi;
cov /* Declare non-zero covariance parameters. */
weight length = phi12;