turn on suggestions

Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.

Showing results for

Find a Community

- Home
- /
- Analytics
- /
- Stat Procs
- /
- determine means/correlation matrix and growth curv...

Topic Options

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

09-20-2016 10:43 AM

Hi All,

I am working with a longitudinal dataset, and am having trouble with proc mianalyze. I would like to impute the data (I have both continuous and ordinal data). My DV's are skewed so I used a log transformation. I would like to:

1) get the overall imputed means of PV1-PV4, RV1-RV4. I am having trouble with MIANALYZE and obtaining the proper Standard deviations.

2) get an overall imputed correlation matrix (RSafe1-RSafe4 RV1 RV2 RV3 RV4 PV1 PV2 PV3 PV4 cgrade_2 t1age t2age t3age t4age Teach1-Teach4 Par1-Par4 Ord1-Ord4 Fair1-Fair4 Shar1-Shar4 Stu1-Stu4). I am only able to get a correlation coefficient of one estimate.

3) build a growth curve model using SAS PROC mixed. I'm able to use the array statement to flip the data to long format after imputation, but not too sure how to get/use parameter estimates and covariance estimates in proc MIANALYZE. How would I test a series of models after imputation? (i.e. testing a linear model with the variable t4s, then entering the variable "girls" at level 2, etc)

Any help would be appreociated.

1) *Imputation code Impute n = 5 datasets with log transformed victimization;

PROC MI DATA=add OUT=log NIMPUTE=5 SEED=33;

transform log (RV1-RV4 PV1-PV4);

CLASS cgrade_2 girls group_2 RSafe1 RSafe2 RSafe3 RSafe4;

FCS logistic (girls = PV1 RV1 PV2 RV2 PV3 RV3 PV4 RV4 cgrade_2);

FCS logistic(RSafe1= PV1 RV1 cgrade_2 girls/classeffects=include);

FCS logistic(RSafe2= PV1 RV1 PV2 RV2 cgrade_2 girls/classeffects=include);

FCS logistic(RSafe3= PV1 RV1 PV2 RV2 PV3 RV3 cgrade_2 girls/classeffects=include);

FCS logistic(RSafe4= PV1 RV1 PV2 RV2 PV3 RV3 PV4 RV4 cgrade_2 girls /classeffects=include);

VAR girls group_2 RSafe1-RSafe4 RV1 RV2 RV3 RV4 PV1 PV2 PV3 PV4 cgrade_2 t1age t2age t3age t4age Teach1-Teach4 Par1-Par4 Ord1-Ord4 Fair1-Fair4 Shar1-Shar4 Stu1-Stu4;

RUN;

proc sort data=log;

by _imputation_ cgrade_2 id;

run;

1) Obtaining means/sd from imputation;

Step 1: obtaining the means and standard deviations for victimization;

proc univariate data=log noprint;

var PV1-PV4 RV1-RV4;

output out=outuni mean=PV1-PV4 RV1-RV4;

stderr=PV1 PV2 PV3 PV4 RV1 RV2 RV3 RV4; *I think this step is wrong, as they are similar to the parameters;

by _Imputation_;

run;

*Step 2 combine 5 datasets edf is 886 since we have that many observations?;

proc mianalyze data=outuni edf=886;

modeleffects PV1 PV2 PV3 PV4 RV1 RV2 RV3 RV4;

stderr PV1 PV2 PV3 PV4 RV1 RV2 RV3 RV4; *I think this step is wrong, as they are similar to the parameters;

run;

2) Correlation matrix after imputation. Is there a way to get estimates for the whole matrix?;

*correlation steps for RV and PV at T1;

proc corr data=log fisher(biasadj=no);

var PV1 RV1;

by _Imputation_;

ods output FisherPearsonCorr= outz;

run;

proc print data=outz;

title 'Fisher''s Correlation Statistics';

var _Imputation_ ZVal;

run;

data outz;

set outz;

StdZ= 1. / sqrt(NObs-3);

run;

proc mianalyze data=outz;

modeleffects ZVal;

stderr StdZ;

run;

3. Model building using SAS PROC mixed. Does the model need to be finalized to get the parameter estimates and covariance matrix?;

*Transpose the data to long format by imputations. This is okay!;

data flip;

set log;

array pvic {4} PV1 PV2 PV3 PV4;

array rvic {4} RV1 RV2 RV3 RV4;

array center4 {4} c41 c51 c42 c52;

array Safety {4} Rsafe1 RSafe2 RSafe3 RSafe4;

Array age1 {4} t1age t2age t3age t4age;

Array Parent {4} Par1 Par2 Par3 Par4;

Array Student {4} Stu1 Stu2 Stu3 Stu4;

Array Order {4} Ord1 Ord2 Ord3 Ord4;

Array Fairn {4} Fair1 Fair2 Fair3 Fair4;

Array Teache {4} Teach1 Teach2 Teach3 Teach4;

Array Sharin {4} Shar1 Shar2 Shar3 Shar4;

do t=1 to 4;

PV = pvic[t];

RV = rvic[t];

T4s = center4[t];

safe = safety[t];

age = age1[t];

par = parent[t];

stu = student[t];

ord = order[t];

fair = fairn[t];

teach=teache[t];

shar=sharin[t];

output;

end;

drop TPV_1-TPV_4 TRV_1-TRV_4 c41 c42 c43 c44 c45 c51 c52 c53 c54 c55;

run;

*Verified: print for 30 observations. This is okay!;

proc print data=flip (obs = 30);

title ’Dataset after imputation’;

var _imputation_ id PV RV T4s safe age par stu ord fair teach shar;

run;

*Verified: *getting estimates for a linear model for RV? Do all predictors need to be included?;

proc mixed data=flip method = ml asycov covtest;

class ID;

model RV = T4s/ solution ddfm=bw;

random intercept T4s/sub=id type=un;

ods output solutionf = solution covb = covb covparms = covparms asycov = asycov;

by _imputation_;

run;