Calculate predicted values (unianova)
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 | * QUESTION: >> we have been modeling visitor numbers as linear functions of several >> independent variables. We now want to validate this model using some >> extra observations that have become available, without re-fitting the >> whole model, i.e. we want to apply the GLM we have constructed to new >> data to make predictions for these (and compare them with the observed >> values, naturally). >> >> Doing this for regression is easy and fairly straightforward: you just >> set the dependent variable to missing for the cases for which you want >> to make predictions. This does not work for GLM. Neither does a >> Select Cases. We are obviously not eager to recode everything for >> regression, or to explicitly compute predictions from the parameters. >> Does anyone have suggestions how to avoid this? * Solution posted to usenet on 2001/02/26. *This is a work around solution which automatically calculates the predicted values for the missing values of y. * UNIANOVA: Calculate predicted values. * Raynald Levesque rlevesque@videotron.ca DATA LIST LIST /a(f2.0) b(f2.0) y(f2.0) . BEGIN DATA. 4 7 3 6 4 2 7 8 5 9 15 7 5 4 . END DATA. UNIANOVA y WITH a b /METHOD = SSTYPE(3) /INTERCEPT = INCLUDE /SAVE = PRED RESID /PRINT = PARAMETER /CRITERIA = ALPHA(.05) /DESIGN = a b /OUTFILE=COVB('C:\\temp\\param.sav'). SAVE OUTFILE='c:\\temp\\mydata.sav'. GET FILE='C:\\temp\\param.sav'. SELECT IF (rowtype_="EST"). FORMATS p1 p2 p3 (F14.8). WRITE OUTFILE="C:\\temp\\calc predicted.sps" /"COMPUTE mypre=",p1," + a*",p2," + b*",p3,".". EXECUTE. GET FILE='c:\\temp\\mydata.sav'. INCLUDE FILE="C:\\temp\\calc predicted.sps". EXECUTE. |
Related pages
...