Programming the statistical procedures from SAS

repeated measures ANOVA

Accepted Solution Solved
Reply
New Contributor
Posts: 4
Accepted Solution

repeated measures ANOVA

Hi,

 

I created a running this procedure for repeated measures:

data blood;
set WORK.STAT;
dv=t0; ido=1; output;
dv=t1; ido=2; output;
dv=t5; ido=3; output;
dv=t10; ido=4; output;
dv=t15; ido=5; output;
dv=t20; ido=6; output;
drop t0 t1 t5 t10 t15 t20;
run;
proc mixed data=blood;
class sub ROI gender ido;
model dv=gender ROI ido gender*ROI baseline;
repeated ido / subject=sub type=cs;
lsmeans gender*ROI /pdiff;
run;

This running is OK. But if I modify the model with a different type of covariance structure (un or AR(1) or ARH(1))

 

repeated ido / subject=sub type=un;

 

then the message:

"An infinite likelihood is assumed in iteration 0 because of a nonpositive definite estimated R matrix for Sub 4." and no results. What is the problem?

 Thanks for the help.

 

Regards: dinyae


Accepted Solutions
Solution
‎01-22-2016 05:19 AM
Valued Guide
Valued Guide
Posts: 673

Re: repeated measures ANOVA

Check out that article I mentioned earlier. You problem is related to the second listed reason you get this error message. Your subject for the repeated measures is not sub, but sub*roi. For example, your listed "sub=4" includes all the different levels of roi and all the times for all the roi.But for repeated measures, you need to identify the the actual subject being measured each time. This is the unique combination of sub and roi. In a sense, this is the same as the first reason because you are getting multiple observations of each time.

Change the repeated statement to:

repeated ido / subject=sub*roi type=un;

 

I know this works (I tried it on your data).

View solution in original post


All Replies
Valued Guide
Valued Guide
Posts: 673

Re: repeated measures ANOVA

 

You probably have more than one observation per class level per subject for the repeated measure. You can only have one value for each time for each factor level. Ths is usually due to a typing error entering the data.  See this excelelnt article about errors with mixed model procedures.

http://support.sas.com/resources/papers/proceedings12/332-2012.pdf

New Contributor
Posts: 4

Re: repeated measures ANOVA

Thanks. I check all entered data: no results with type=un too.  Have you got any idea yet?

Valued Guide
Valued Guide
Posts: 673

Re: repeated measures ANOVA

Sometimes it is very hard to find the problem observation. Your message says subject 4. Look carefully.
SAS Super FREQ
Posts: 3,301

Re: repeated measures ANOVA

[ Edited ]

Let SAS do the search. If I understand LVM's suggestion, try running the following:

proc print data=blood;
where sub=4;

var sub ROI gender ido; run;
New Contributor
Posts: 4

Re: repeated measures ANOVA

Thanks for everybody. I am puzzled a bit. I do not see the problem. I copied here the SAS running:

 

data fok;

input ROI Sub Gender $ Baseline t0 t1 t5 t10 t15 t20;

cards;

1 4 male 319 . 414 324 327 327 311

2 4 male 300 91 355 273 269 279 270

3 4 male 392 211 469 415 390 392 364

4 4 male 184 190 184 181 162 173 170

5 4 male 197 170 281 195 185 189 184

6 4 male 197 207 255 196 185 194 194

7 4 male 200 220 242 197 183 193 198

8 4 male 226 147 225 224 228 238 243

9 4 male 287 144 389 270 271 262 255

10 4 male 296 276 294 251 208 226 232

11 4 male 382 353 445 339 308 283 287

12 4 male 266 296 277 251 221 220 216

13 4 male 227 250 242 . . . .

1 5 male 205 . 293 230 224 214 215

2 5 male 213 99 261 226 219 208 213

3 5 male 204 113 306 230 225 214 212

4 5 male 144 138 137 143 142 141 142

5 5 male 186 187 190 192 187 182 189

6 5 male 166 167 166 174 173 172 176

7 5 male 159 155 156 164 160 160 163

8 5 male 217 198 221 216 211 206 211

9 5 male 248 212 303 262 246 233 233

10 5 male 201 173 201 199 191 181 185

11 5 male 254 202 308 274 249 238 232

12 5 male 227 207 236 248 248 219 217

13 5 male . . 250 261 247 217 215

1 7 male 198 . 405 309 253 241 236

2 7 male 197 95 359 300 239 228 220

3 7 male 226 213 460 360 285 269 262

4 7 male 194 191 184 186 169 168 164

5 7 male 194 227 298 237 200 196 196

6 7 male 167 198 233 190 171 167 170

7 7 male 172 211 225 190 180 174 172

8 7 male 227 196 303 279 234 238 229

9 7 male 239 205 439 349 272 262 251

10 7 male 214 196 270 279 241 225 217

11 7 male 253 237 399 343 286 265 253

12 7 male 218 236 267 249 226 219 209

13 7 male 210 262 237 225 210 209 203

1 10 female 198 . 272 214 180 176 166

2 10 female 162 70 215 181 151 142 142

3 10 female 208 115 285 236 188 182 172

4 10 female 118 120 115 125 106 108 119

5 10 female 135 152 161 150 124 124 119

6 10 female 140 141 164 150 127 125 121

7 10 female 133 136 146 136 118 115 121

8 10 female 159 119 185 176 149 148 139

9 10 female 210 140 258 232 193 191 182

10 10 female 185 171 222 192 160 162 147

11 10 female 240 197 293 247 189 186 168

12 10 female 230 248 270 238 195 187 179

13 10 female 198 215 212 208 165 160 149

1 11 male 208 . 252 228 276 318 323

2 11 male 213 86 228 270 309 324 317

3 11 male 177 105 236 231 264 290 295

4 11 male 179 183 187 185 195 196 192

5 11 male 208 212 292 322 333 297 268

6 11 male 195 212 229 257 261 230 218

7 11 male 184 198 191 216 218 208 205

8 11 male 248 186 301 313 311 318 320

9 11 male 238 153 347 369 381 364 335

10 11 male 224 212 262 260 273 251 247

11 11 male 286 242 407 428 423 427 405

12 11 male 219 228 311 320 306 302 278

13 11 male 216 229 279 294 279 271 261

1 12 female 127 . 284 209 196 185 167

2 12 female 130 75 238 180 168 167 152

3 12 female 118 101 322 272 238 200 173

4 12 female 146 152 139 128 129 137 130

5 12 female 123 121 198 140 134 133 134

6 12 female 122 118 169 135 131 135 132

7 12 female 134 126 149 150 137 161 143

8 12 female 145 113 196 160 160 169 165

9 12 female 154 112 315 229 199 187 185

10 12 female 167 132 204 199 189 187 170

11 12 female 234 147 389 361 322 262 242

12 12 female 167 172 221 253 265 194 173

13 12 female 173 170 202 223 251 182 172

1 14 female 204 . 337 273 221 205 188

2 14 female 176 92 254 221 181 174 158

3 14 female 206 124 368 306 238 212 195

4 14 female 135 139 136 132 130 122 115

5 14 female 141 155 187 151 143 133 127

6 14 female 149 157 172 154 148 143 137

7 14 female 162 165 169 165 153 150 142

8 14 female 230 200 242 239 221 215 196

9 14 female 216 211 326 243 213 187 183

10 14 female 265 211 275 292 263 268 248

11 14 female 319 238 386 400 322 300 278

12 14 female 195 207 210 218 183 177 164

13 14 female 182 190 192 198 . . .

1 26 female 133 . 219 152 148 137 126

2 26 female 130 93 196 143 143 132 123

3 26 female 129 106 222 157 147 132 118

4 26 female 140 140 129 122 117 110 103

5 26 female 149 155 158 149 144 140 133

6 26 female 141 143 145 137 136 131 123

7 26 female 138 138 142 129 134 128 120

8 26 female 135 116 142 121 128 126 119

9 26 female 160 122 204 167 158 154 144

10 26 female 174 170 180 141 152 151 139

11 26 female 196 194 218 161 159 158 140

12 26 female 177 191 176 141 140 138 121

13 26 female 176 201 178 158 141 143 111

1 27 female 238 . 320 252 249 260 249

2 27 female 258 100 315 273 274 281 271

3 27 female 235 117 323 260 261 264 254

4 27 female 241 234 290 211 223 197 221

5 27 female 250 256 295 223 241 227 249

6 27 female 258 260 295 209 229 213 242

7 27 female 254 258 292 208 232 215 234

8 27 female 264 206 289 254 281 273 277

9 27 female 260 155 309 239 259 249 260

10 27 female 253 158 291 260 299 285 295

11 27 female 338 150 399 348 356 366 347

12 27 female 386 306 422 375 362 347 361

13 27 female 311 297 350 308 291 261 298

1 29 male 188 . 321 304 314 294 284

2 29 male 215 82 291 303 314 301 294

3 29 male 175 162 348 337 354 314 303

4 29 male 217 243 234 218 220 219 222

5 29 male 187 197 231 202 228 203 212

6 29 male 168 185 211 179 199 180 183

7 29 male 180 204 202 185 219 187 199

8 29 male 234 225 258 243 281 259 268

9 29 male 257 229 340 326 324 314 311

10 29 male 227 229 286 253 304 271 263

11 29 male 292 267 435 414 394 362 344

12 29 male 207 223 265 248 266 251 241

13 29 male 230 . 273 257 264 . .

1 30 female 271 . 393 310 389 428 439

2 30 female 233 64 322 276 309 339 348

3 30 female 260 86 404 309 384 416 431

4 30 female 210 224 217 197 188 186 178

5 30 female 202 147 225 194 212 211 213

6 30 female 181 198 189 173 178 186 185

7 30 female 199 209 202 194 199 209 207

8 30 female 243 115 297 247 252 287 284

9 30 female 288 102 430 290 312 334 338

10 30 female 248 139 289 229 222 254 276

11 30 female 378 128 481 373 364 399 436

12 30 female 254 233 289 219 195 228 245

13 30 female 263 267 259 206 193 204 220

1 32 female 194 . 323 249 266 253 232

2 32 female 180 68 281 225 229 217 201

3 32 female 194 98 357 274 285 261 234

4 32 female 213 211 211 193 177 172 159

5 32 female 190 129 274 234 213 208 184

6 32 female 164 147 232 189 177 175 155

7 32 female 161 158 227 188 181 182 165

8 32 female 180 108 207 193 199 188 171

9 32 female 238 100 370 291 273 252 225

10 32 female 203 159 224 194 190 187 176

11 32 female 329 225 366 293 258 250 227

12 32 female 197 213 210 167 143 145 134

13 32 female 201 215 205 182 176 . .

1 37 female 313 . 321 244 234 224 202

2 37 female 279 103 273 229 217 205 191

3 37 female 357 248 374 304 274 255 223

4 37 female 175 188 173 174 158 166 152

5 37 female 192 195 233 212 187 189 174

6 37 female 182 202 235 205 186 181 172

7 37 female 183 196 211 200 186 183 173

8 37 female 201 126 199 208 204 198 188

9 37 female 281 171 327 289 258 248 229

10 37 female 211 211 236 215 212 204 196

11 37 female 286 247 309 253 240 211 205

12 37 female 200 224 204 190 182 174 167

13 37 female 178 192 176 169 163 155 150

1 38 female 237 . 326 247 232 222 220

2 38 female 211 89 268 215 199 190 191

3 38 female 242 155 323 265 241 231 230

4 38 female 192 188 187 189 182 184 192

5 38 female 215 202 251 233 209 216 216

6 38 female 182 170 184 175 171 177 180

7 38 female 209 192 193 187 180 175 184

8 38 female 199 138 220 201 185 177 178

9 38 female 283 162 321 279 260 265 258

10 38 female 240 215 254 229 209 204 206

11 38 female 323 265 358 303 272 260 258

12 38 female 225 195 224 213 194 189 185

13 38 female 196 . 195 189 176 174 170

1 50 male 191 . 429 384 380 346 319

2 50 male 186 113 364 344 326 294 271

3 50 male 210 299 532 505 469 421 366

4 50 male 186 201 173 180 183 168 175

5 50 male 176 191 230 210 198 183 180

6 50 male 182 187 213 207 196 181 183

7 50 male 185 191 186 193 186 182 188

8 50 male 186 186 201 207 214 209 209

9 50 male 220 207 337 286 258 246 234

10 50 male 209 208 261 252 237 237 230

11 50 male 222 222 397 361 309 297 269

12 50 male 159 168 221 189 174 170 166

13 50 male 161 164 244 205 . 178 174

1 51 male 158 . 292 184 189 176 184

2 51 male 161 70 273 177 185 172 178

3 51 male 153 105 304 192 191 174 179

4 51 male 149 155 158 157 162 154 154

5 51 male 154 86 271 173 169 158 162

6 51 male 153 135 229 166 163 151 158

7 51 male 162 157 189 172 184 171 179

8 51 male 169 86 256 199 204 188 192

9 51 male 177 75 316 204 203 186 190

10 51 male 184 193 261 209 206 193 196

11 51 male 190 204 311 227 214 193 194

12 51 male 171 186 204 177 176 164 168

13 51 male 170 191 197 179 175 172 169

1 59 female 205 . 305 217 217 216 211

2 59 female 219 93 289 226 225 227 219

3 59 female 221 211 346 236 234 227 230

4 59 female 203 217 204 198 196 192 187

5 59 female 203 220 206 203 198 191 190

6 59 female 194 206 198 193 189 186 185

7 59 female 199 214 211 201 191 191 191

8 59 female 236 242 253 237 236 229 230

9 59 female 249 236 284 251 245 236 238

10 59 female 247 180 248 232 245 248 236

11 59 female 214 115 279 223 215 224 221

12 59 female 179 208 227 181 173 183 179

13 59 female 174 235 198 172 181 178 172

;

proc corr data=fok cov;

var t0 t1 t5 t10 t15 t20;

run;

data blood;

set fok;

dv=t0; ido=1; output;

dv=t1; ido=2; output;

dv=t5; ido=3; output;

dv=t10; ido=4; output;

dv=t15; ido=5; output;

dv=t20; ido=6; output;

drop t0 t1 t5 t10 t15 t20;

run;

proc print data=blood;

where sub=4;var sub ROI gender ido;

run;

proc mixed data=blood;

class sub ROI gender ido;

model dv=gender ROI ido gender*ROI baseline;

repeated ido / subject=sub type=un;

lsmeans gender*ROI /pdiff;

run;

 

Solution
‎01-22-2016 05:19 AM
Valued Guide
Valued Guide
Posts: 673

Re: repeated measures ANOVA

Check out that article I mentioned earlier. You problem is related to the second listed reason you get this error message. Your subject for the repeated measures is not sub, but sub*roi. For example, your listed "sub=4" includes all the different levels of roi and all the times for all the roi.But for repeated measures, you need to identify the the actual subject being measured each time. This is the unique combination of sub and roi. In a sense, this is the same as the first reason because you are getting multiple observations of each time.

Change the repeated statement to:

repeated ido / subject=sub*roi type=un;

 

I know this works (I tried it on your data).

New Contributor
Posts: 4

Re: repeated measures ANOVA

Thanks you very much.  I thankful for you to your advices/support!

 
☑ This topic is SOLVED.

Need further help from the community? Please ask a new question.

Discussion stats
  • 7 replies
  • 387 views
  • 2 likes
  • 3 in conversation