* Encoding: UTF-8. get file='D:\data\Seminars\nhanes2f.sav'. * question set 1. * 1 Get the means for the variables "iron" and "hgb"; include the weighted (population) and unweight size and the 95% confidence intervals in the output. csdescriptives /plan file = 'D:\data\Seminars\nhanes2f_plan.csaplan' /summary variables = iron hgb /mean /statistics se count popsize cin(95). * 2 Get a frequency table for the variable "sex"; include both the weighted (population) and unweighted size and the design effect. cstabulate /plan file = 'D:\data\Seminars\nhanes2f_plan.csaplan' /tables variables = sex /cells popsize /statistics count deff. * 3 Is there a relationship between the variables "sex" and "agegrp"?. cstabulate /plan file = 'D:\data\Seminars\nhanes2f_plan.csaplan' /tables variables = sex by agegrp /cells popsize tablepct /statistics count expected /test independence. * no, the p-value is 0.29, which is not statistically significant. * question set 2. * 1 Run a t-test with the variable "heartatk as the predictor and the variable "vitaminc" as the outcome. csglm vitaminc by heartatk /plan file = 'D:\data\Seminars\nhanes2f_plan.csaplan' /model heartatk /statistics parameter cinterval ttest /test type = adjf. * 2 Is the result statistically significant?. * no - the p-value is 0.181. * 3 Run a regression model with the variable "vitaminc" as the outcome and one continuous and one categorical variable of your choice Include the regression coefficients, test statistics and 95% confidence intervals in the output. csglm vitaminc by heartatk with age /plan file = 'D:\data\Seminars\nhanes2f_plan.csaplan' /model heartatk age /statistics parameter cinterval ttest /test type = adjf. * 4 How are the degrees of freedom for the model calculated?. * the numerator df is one because there is only one predictor. * the denominator df is the number of clusters minus the number of strata: 62 - 31 = 31. * 5 Rerun your regression with data from females only. csglm vitaminc by heartatk with age /plan file = 'D:\data\Seminars\nhanes2f_plan.csaplan' /model heartatk age /statistics parameter cinterval ttest /test type = adjf /domain variable = female(1). * question set 3. * 1 Create a three-level variable from the variable "iron"; try to keep the number of unweighted cases similar across the levels. examine variables = iron. * min = 16, mean = 99.45, max = 321. * no missing data. graph /histogram = iron. * cut at 85 and 110. compute iron3 = 2. if iron lt 85 iron3 = 1. if iron gt 110 iron3 = 3. freq var = iron3. * 2 Run an ordinal logistic regression with this new variable as the outcome and three predictors of your choice. csordinal iron3(ascending) with age female by region /plan file = 'D:\data\Seminars\nhanes2f_plan.csaplan' /statistics parameter exp cinterval ttest /test type = adjf. * 3 Test the parallel line assumption. csordinal health(ascending) by female region with age /plan file = 'D:\data\Seminars\nhanes2f_plan.csaplan' /model female region age /statistics parameter exp cinterval ttest /nonparallel test. * 4 What would you do if the assumption was not met?. csordinal health(ascending) by female region with age /plan file = 'D:\data\Seminars\nhanes2f_plan.csaplan' /model female region age /statistics parameter exp cinterval ttest /nonparallel test parameter.