Skip to content

Commit

Permalink
Update cooks distance plot
Browse files Browse the repository at this point in the history
  • Loading branch information
agosiewska committed Aug 6, 2018
1 parent c6053b4 commit 91f09f3
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion R/observationInfluence.R
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ observationInfluence <- function(object, ...){

cooksDistances <- scoreCooksDistance(object, ...)

result <- data.frame(cooks.dist = cooksDistances, label = object$label, index = rownames(object$data))
result <- data.frame(cooks.dist = cooksDistances, label = object$label, index = 1:length(object$y))
result <- result[order(-result$cooks.dist),]

class(result) <- c("observationInfluence", "data.frame")
Expand Down
2 changes: 1 addition & 1 deletion R/plotCooksDistance.R
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ plotCooksDistance <- function(object, nlabel = 3, ...){

ggplot(df, aes(index, cooks.dist)) +
geom_point() +
geom_text(data = subset(df, big==TRUE), aes(label=as.character(index)),hjust=-0.2,vjust=-0.2) +
geom_text(data = subset(df, big==TRUE), aes(label=as.character(index)), color = "grey") +
facet_grid(label ~ .) +
xlab("observation index") +
ylab("cook's distance") +
Expand Down

0 comments on commit 91f09f3

Please sign in to comment.