# [R] Why can't I figure this out? :S

Carl Witthoft carl at witthoft.com
Tue Dec 6 02:12:25 CET 2011

```If you 'don't speak computer,' what are you doing trying to run R in the
first place?

<quote>
From: Jasmine007 <magee20v_at_uregina.ca>
Date: Mon, 05 Dec 2011 16:32:00 -0800 (PST)

Hi, so I don't speak computer and I have no idea what this code is
telling the program to do, but I apparently need to be able to find and
isolate influencial observations. Problem, I have no idea what the error
means and where it may be from in the code.

error I get is below the code

{
## OLS results

## default: choose psamp = quantile

n <- length(residuals(NameC))
k <- length(coef(NameC))
if(is.null(quantile)) quantile <- c(floor((n + k + 1)/2), floor((n + k)/2))
quantile <- rep(quantile, length.out = 2) if(is.null(psamp)) psamp <-
quantile

## LTS results with robust residuals

NameC_lts <-
quantile = quantile, psamp = psamp, nsamp = nsamp) rr <-
residuals(NameC_lts)/NameC_lts\$scale rr_nok <- abs(rr) > critval
## robust leverage via MCD (or MVE)

X <- model.matrix(NameC)[,-1]
cv <- cov.rob(X, method = method,
quantile = quantile, nsamp = dist_nsamp) rd <- sqrt(mahalanobis(X,
cv\$center, cv\$cov)) rd_nok <- rd > critval
## ROBUST results

nok <- rr_nok & rd_nok
NameC_rob <- lm(formula, data[!nok,])
rval <- list(ols = NameC, lts = NameC_lts, robust = NameC_rob, cov.rob =
cv, robresid = rr, robdist = rd, high_residuals = rr[rr_nok],
high_leverage = rd[rd_nok], bad_leverage = nok, psamp = psamp, method =
method, nsamp = list(lts = nsamp, dist = dist_nsamp), quantile =
list(lts = quantile, dist = quantile)) return(rval)
}

Error: object of type 'closure' is not subsettable

Any ideas, In plain non-computer language.. I have a headache from