Using a regression coefficient in syntax

Moderators: statman, Analyst Techy, andris, Fierce, GerineL, Smash

ColinGroot
Posts: 1
Joined: Thu Aug 13, 2015 8:44 am

Using a regression coefficient in syntax

Postby ColinGroot » Thu Aug 13, 2015 8:55 am

Hi All,

This is my first question on this board so first of all: HI!

My question is the following. I did a GLM regression analysis in SPSS syntax and i would like to use the regression coefficients from this regression to COMPUTE a new variable. as follows:

DATASET ACTIVATE DataSet3.
REGRESSION
/DESCRIPTIVES MEAN STDDEV CORR SIG N
/MISSING LISTWISE
/STATISTICS COEFF OUTS R ANOVA
/CRITERIA=PIN(.05) POUT(.10)
/NOORIGIN
/DEPENDENT LDST90
/METHOD=ENTER Age Sex
/SAVE PRED RESID.

EXECUTE.

DATASET ACTIVATE DataSet2.
COMPUTE PRED_LDST90=69.466 + (Age2 * -0.368) + (Sex2 * 1.294).
EXECUTE.

As you van see, I have manually inserted the constant, and Age/Sex regression coefficients (-0.368 and 1.294) into the COMPUTE command at the bottom but I would like the syntax to automatically read the regression coefficients from the regression analysis at the top.

How to proceeed?
Thanks in advance,
CG
GerineL
Moderator
Posts: 1477
Joined: Tue Jun 10, 2008 4:50 pm

Re: Using a regression coefficient in syntax

Postby GerineL » Thu Aug 13, 2015 10:38 am

I don't know if you can save the exact coefficients in a variable, you can however save the predicted values from a regression directly under the save option.
statman
Administrator
Posts: 2700
Joined: Tue Jun 12, 2007 12:08 pm
Location: Florida, USA

Re: Using a regression coefficient in syntax

Postby statman » Thu Aug 13, 2015 7:34 pm

Check into the OMS facility, but ..............
See the note below

NOTE: Please read the Posting Guidelines and always tell us your OS, the SPSS version and information about your study and data!

Statman
Statistical Services
JonPedersen
Posts: 117
Joined: Wed May 25, 2011 7:07 am
Contact:

Re: Using a regression coefficient in syntax

Postby JonPedersen » Wed Aug 26, 2015 12:28 pm

Hi,
As GerineL says, you can just save the predicted values. If you need the coefficients for something more complex, oms is the way to go. (No need to be scared, statman).

Code: Select all

DATASET DECLARE  coeffdataset.
OMS
  /SELECT TABLES
  /IF COMMANDS=['Regression'] SUBTYPES=['Coefficients']
  /DESTINATION FORMAT=SAV NUMBERED=TableNumber_
   OUTFILE='coeffdataset'
  /COLUMNS SEQUENCE=[RALL CALL LALL].
regression  variables =age sex dep
/dependent dep
/method enter.
OMSEND.
This will give you a datasetset with a single line with all your coefficents (and some other stuff). Then you can just merge the dataset into your original file.
(NB: Remember the OMSEND - otherwise nothing gets saved, and one can spend hours figuring it out).
Best
Jon

Who is online

Users browsing this forum: No registered users and 2 guests

cron