-4

I'm trying to do a variable selection using LTS regression but I encounter with this error.

sigma.full<-summary(ltsreg(y~x1+x2+x3+x4+x5))$scale

Error in summary(ltsreg(y~x1+x2+x3+x4+x5))$scale: $ operator is invalid for atomic vectors

Can someone help me to resolve this error?

David Arenburg
  • 91,361
  • 17
  • 137
  • 196

1 Answers1

3

Assuming you are using the function MASS::ltsreg

Use

sigma.full<-ltsreg(y~x1+x2+x3+x4+x5)$scale

Have a look at ?ltsreg.

The result of ltsreg(y~x1+x2+x3+x4+x5) itself has the scale-information. The summary of it does not have a $scale element.

Have a look at str(summary(ltsreg(...))) as Roland suggests

Rentrop
  • 20,979
  • 10
  • 72
  • 100