title m5 1 gms ordinary least squares using nlp ontext
play

$TITLE: M5-1.GMS, ordinary least squares using NLP $ONTEXT there - PowerPoint PPT Presentation

C:\jim\COURSES\8858\code-bk 2012\M5-1.gms Monday, January 09, 2012 6:05:32 AM Page 1 $TITLE: M5-1.GMS, ordinary least squares using NLP $ONTEXT there are I observations on two variables (set J), a dependent variables Y and an independent


  1. C:\jim\COURSES\8858\code-bk 2012\M5-1.gms Monday, January 09, 2012 6:05:32 AM Page 1 $TITLE: M5-1.GMS, ordinary least squares using NLP $ONTEXT there are I observations on two variables (set J), a dependent variables Y and an independent variable X. the objective is to estimate a linear relationship vias OLS minimizing the sum of squared deviations $OFFTEXT SETS I o b s e r v a t i o n s /I1*I4/ J dep and ind var /J1*J2/; PARAMETERS Y0(I) X0(I); TABLE BENCH(I,J) J1 J2 I1 4 2 I2 3 4 I3 10 6 I4 14 11; DISPLAY BENCH;

  2. C:\jim\COURSES\8858\code-bk 2012\M5-1.gms Monday, January 09, 2012 6:05:32 AM Page 2 Y0(I) = BENCH(I, "J1"); X0(I) = BENCH(I, "J2"); DISPLAY Y0, X0; VARIABLES ALPHA BETA DEV YHAT(I); EQUATIONS EYHAT(I) OBJECTIVE; OBJECTIVE.. DEV =E= SUM (I, (YHAT(I) - Y0(I))*(YHAT(I) - Y0(I))); EYHAT(I).. YHAT(I) =E= ALPHA + BETA*X0(I); MODEL OLS /ALL/; ALPHA.L = 1; BETA.L = 1; SOLVE OLS USING NLP MINIMIZING DEV;

  3. C:\jim\COURSES\8858\code-bk 2012\M5-1.gms Monday, January 09, 2012 6:05:32 AM Page 3 * process output to get observed and fitted values of Y PARAMETER RESULTS(I,*); RESULTS(I, "X0") = X0(I); RESULTS(I, "YHAT") = YHAT.L(I); RESULTS(I, "Y0") = Y0(I); DISPLAY RESULTS; $LIBINCLUDE XLDUMP RESULTS M5-1.XLS SHEET1!C3

Download Presentation
Download Policy: The content available on the website is offered to you 'AS IS' for your personal information and use only. It cannot be commercialized, licensed, or distributed on other websites without prior consent from the author. To download a presentation, simply click this link. If you encounter any difficulties during the download process, it's possible that the publisher has removed the file from their server.

Recommend


More recommend