COMMENT Retrieve the data set (Note if you are retrieving the data from a different location then you need to insert the correct path here).
GET
FILE='L:\spsscourse\foundry.sav'.
COMMENT First step is to generate descriptive statistics to gain a feel for the data.
COMMENT Frequency tables are useful when describing categorical data.
FREQUENCIES
VARIABLES=bron smkever cigno
/ORDER= ANALYSIS .
COMMENT Whereas descriptive statistics are useful when dealing with quantitative data.
DESCRIPTIVES
VARIABLES=respdust cigno
/STATISTICS=MEAN STDDEV MIN MAX .
COMMENT Sometimes it is appropriate to generate a new variable from the existing data.
COMMENT In this case the duration of patients in the employment.
COMPUTE lenemp = (CTIME.DAYS(dtassmnt)-CTIME.DAYS(dtemplmt))/365 .
EXECUTE .
COMMENT Or the ratio of FEV and FVC.
COMPUTE fevratio = fevmeas / fevpred .
EXECUTE .
COMPUTE fvcratio = fvcmeas / fvcpred .
EXECUTE .
COMMENT To examine the existance of a relationship between categorical data, the chi squared option in the crosstabs procedure is performed.
COMMENT In this case is there are relationship between smoking status and bronchitis symptoms.
CROSSTABS
/TABLES=smknow BY bron
/FORMAT= AVALUE TABLES
/STATISTIC=CHISQ
/CELLS= COUNT ROW COLUMN
/COUNT ROUND CELL .
COMMENT In another case to examine the relationship between Exposure to dust and symptoms of bronchitis.
CROSSTABS
/TABLES=group BY bron
/FORMAT= AVALUE TABLES
/STATISTIC=CHISQ
/CELLS= COUNT
/COUNT ROUND CELL .
COMMENT In another case to examine the relationship between Exposure to dust and symptoms of asthma.
CROSSTABS
/TABLES=group BY asthma
/FORMAT= AVALUE TABLES
/STATISTIC=CHISQ
/CELLS= COUNT
/COUNT ROUND CELL .
COMMENT A good way to describe easily a continuous dataset is to create a graph, such as a Histogram.
COMMENT For example for the variable that represents age.
GRAPH
/HISTOGRAM(NORMAL)=age .
COMMENT For the continuous measures such as the FEV and FVC ratio's it is useful to be able to describe the ratio characteristics within subgroups.
COMMENT So for the FEV ratio.
EXAMINE
VARIABLES=fevratio BY group
/PLOT BOXPLOT
/COMPARE GROUP
/STATISTICS DESCRIPTIVES
/CINTERVAL 95
/MISSING LISTWISE
/NOTOTAL.
COMMENT The FVC ratio.
EXAMINE
VARIABLES=fvcratio BY group
/PLOT BOXPLOT
/COMPARE GROUP
/STATISTICS DESCRIPTIVES
/CINTERVAL 95
/MISSING LISTWISE
/NOTOTAL.
COMMENT It may be important to determine whether there is a statistically significant difference in a continuous variable between two sub groups.
COMMENT In this case does FEV ratio differ between exposed and not exposed cases.
T-TEST
GROUPS = group(0 1)
/MISSING = ANALYSIS
/VARIABLES = fvcratio
/CRITERIA = CI(.95) .
COMMENT It may be suggested that there is a Linear trend in the effect of one variable on the outcome.
COMMENT This relationship can be checked using Linear Regression.
COMMENT A relationship has been suggested between FVC ratio and dust levels.
REGRESSION
/MISSING LISTWISE
/STATISTICS COEFF OUTS R ANOVA
/CRITERIA=PIN(.05) POUT(.10)
/NOORIGIN
/DEPENDENT fvcmeas
/METHOD=ENTER respdust
/RESIDUALS NORM(ZRESID) .
COMMENT The comparisons made so far have assumed that the two groups being compared are independent.
COMMENT However this may not always be the case as it may occur that the groups are related or paired.
COMMENT In the case of comparing measured and predicted ratios for FVC and FVC a Paired comparison such as a Paired T-test is required.
T-TEST
PAIRS = fvcmeas WITH fvcpred (PAIRED)
/CRITERIA = CI(.95)
/MISSING = ANALYSIS.
LOGISTIC REGRESSION bron
/METHOD = ENTER respdust
/PRINT = GOODFIT
/CRITERIA = PIN(.05) POUT(.10) ITERATE(20) CUT(.5) .