From: Mene Nema on 15 Jun 2010 17:38 Dear Users, I am trying to specify a simple structural equation equation model using NLMIXED. There are only two latent predictor variables (f1 and f2) with 3 and 2 indicators (x-variables) and one latent criterion variable "eta" with 4 indicators (y-variables). The multivariate/bivariate distribution of the latent exogenous predictor variables (f1,f2) is a finite mixture distribution of two bivariate normal distributions with unknown mean and covariance structure. The latent endogenous variable "eta" is regressed on "f1" and "f2". I wrote some code, but, unfortunately, SAS returns the following error message: "Execution error for observation 1." There must be something fundamentally wrong. And I don't have a clue. I have seen some posts of Dale McLerran, but they did not work for my structural equation model. It would be great if somebody had a hint. Thank you very much! Best, Mene My SAS Code: *****************************************************************************; DATA testdata; INFILE "c:\temp\ZIndicators3b.txt"; INPUT dummy id X1 X2 X3 X4 X5 Y1 Y2 Y3 Y4; RUN; TITLE "testdata"; PROC PRINT DATA=testdata(OBS=574); RUN; proc nlmixed data = testdata (keep = dummy id X1-X5 Y1-Y4); ***starting values; parms lamx21 = 0.9401 lamx31 = 1.0768 lamx52 = 1.1720 lamy21 = 1.0659 lamy31 = 1.0637 lamy41 = 1.0551 interx1 = 0.000 interx2 = 0.000 interx3 = 0.000 interx4 = 0.000 interx5 = 0.000 intery1 = 0.000 intery2 = 0.000 intery3 = 0.000 intery4 = 0.000 thd1 = 0.4582 thd2 = 0.5770 thd3 = 0.3726 thd4 = 0.2938 thd5 = 0.0321 the1 = 0.2594 the2 = 0.1588 the3 = 0.1623 the4 = 0.1757 gamma1 = 0.5284 gamma2 = 0.1754 phi1a = 0.5334 phi2a = 0.7022 phi1b = 0.5334 phi2b = 0.7022 rhoa = 0 rhob = 0 prob = 0.1 to 0.9 by 0.01 psi = 0.5035 mf1a = -.5 mf2a = -.5 mf1b = .5 mf2b = .5; bounds -1< rhoa < 1, -1< rhob < 1, phi1a>=0, phi2a>=0, phi1b>=0, phi2b>=0, thd1-thd5>=0, the1-the4>=0, psi>=0; phi21a=(phi1a*phi2a)**0.5*rhoa; phi21b=(phi1b*phi2b)**0.5*rhob; mu1a = interx1 + 1*f1a; mu2a = interx2 + lamx21*f1a; mu3a = interx3 + lamx31*f1a; mu4a = interx4 + 1*f2a; mu5a = interx5 + lamx52*f2a; mu1b = interx1 + 1*f1b; mu2b = interx2 + lamx21*f1b; mu3b = interx3 + lamx31*f1b; mu4b = interx4 + 1*f2b; mu5b = interx5 + lamx52*f2b; pi = constant('pi'); Px1a = 1 / (((2 * pi) ** 0.5) * thd1) * exp(-0.5 * ((X1 - mu1a) / thd1) ** 2); Px1b = 1 / (((2 * pi) ** 0.5) * thd1) * exp(-0.5 * ((X1 - mu1b) / thd1) ** 2); Px2a = 1 / (((2 * pi) ** 0.5) * thd2) * exp(-0.5 * ((X2 - mu2a) / thd2) ** 2); Px2b = 1 / (((2 * pi) ** 0.5) * thd2) * exp(-0.5 * ((X2 - mu2b) / thd2) ** 2); Px3a = 1 / (((2 * pi) ** 0.5) * thd3) * exp(-0.5 * ((X3 - mu3a) / thd3) ** 2); Px3b = 1 / (((2 * pi) ** 0.5) * thd3) * exp(-0.5 * ((X3 - mu3b) / thd3) ** 2); Px4a = 1 / (((2 * pi) ** 0.5) * thd4) * exp(-0.5 * ((X4 - mu4a) / thd4) ** 2); Px4b = 1 / (((2 * pi) ** 0.5) * thd4) * exp(-0.5 * ((X4 - mu4b) / thd4) ** 2); Px5a = 1 / (((2 * pi) ** 0.5) * thd5) * exp(-0.5 * ((X5 - mu5a) / thd5) ** 2); Px5b = 1 / (((2 * pi) ** 0.5) * thd5) * exp(-0.5 * ((X5 - mu5b) / thd5) ** 2); Px1 = Px1a * prob + Px1b * (1 - prob); Px2 = Px2a * prob + Px2b * (1 - prob); Px3 = Px3a * prob + Px3b * (1 - prob); Px4 = Px4a * prob + Px4b * (1 - prob); Px5 = Px5a * prob + Px5b * (1 - prob); eta = gamma1*f1a + gamma2*f2a + zeta; etb = gamma1*f1b + gamma2*f2b + zeta; mu6a = intery1 + 1*eta; mu6b = intery1 + 1*etb; mu7a = intery2 + lamy21*eta; mu7b = intery2 + lamy21*etb; mu8a = intery3 + lamy31*eta; mu8b = intery3 + lamy31*etb; mu9a = intery4 + lamy41*eta; mu9b = intery4 + lamy41*etb; Py1a = 1 / (((2 * pi) ** 0.5) * the1) * exp(-0.5 * ((Y1 - mu6a) / the1) ** 2); Py1b = 1 / (((2 * pi) ** 0.5) * the1) * exp(-0.5 * ((Y1 - mu6b) / the1) ** 2); Py2a = 1 / (((2 * pi) ** 0.5) * the2) * exp(-0.5 * ((Y2 - mu7a) / the2) ** 2); Py2b = 1 / (((2 * pi) ** 0.5) * the2) * exp(-0.5 * ((Y2 - mu7b) / the2) ** 2); Py3a = 1 / (((2 * pi) ** 0.5) * the3) * exp(-0.5 * ((Y3 - mu8a) / the3) ** 2); Py3b = 1 / (((2 * pi) ** 0.5) * the3) * exp(-0.5 * ((Y3 - mu8b) / the3) ** 2); Py4a = 1 / (((2 * pi) ** 0.5) * the4) * exp(-0.5 * ((Y4 - mu9a) / the4) ** 2); Py4b = 1 / (((2 * pi) ** 0.5) * the4) * exp(-0.5 * ((Y4 - mu9b) / the4) ** 2); Py1 = Py1a * prob + Py1b * (1 - prob); Py2 = Py2a * prob + Py2b * (1 - prob); Py3 = Py3a * prob + Py3b * (1 - prob); Py4 = Py4a * prob + Py4b * (1 - prob); LL = log(Px1 * Px2 * Px3 * Px4 * Px5 * Py1 * Py2 * Py3 * Py4); model dummy ~ general(LL); random f1a f2a f1b f2b zeta ~ normal([mf1a, mf2a, mf1b, mf2b,0], [phi1a, phi21a, phi2a, 0, 0, phi1b, 0, 0, phi21b, phi2b, 0, 0, 0, 0, psi]) subject = id; run; *****************************************************************************;
|
Pages: 1 Prev: Mainframe with SAS Enterprise Guide Next: Data Structure |