Message-ID: <20041108163906.50940.qmail@web53208.mail.yahoo.com>
Date: 2004-11-08T16:39:06Z
From: Derek Margetts
Subject: plotting lm coeficients with their means
I am trying to write a function that will run a linear
model and plot the regression coeficients with their
corresponding means. I am having two problems. I can
get the plot with the function below, but I am having
trouble labeling the points.
function(y,x1,x2,x3,x4){
outlm<-lm(y~x1+x2+x3+x4)
imp<-as.data.frame(outlm$coef[-1])
meanvec<-c(mean(x1),mean(x2),mean(x3),mean(x4))
out<-list(imp,meanvec)
mf<-as.data.frame(out)
plot((mf),xlab="Impact",ylab="performance")
abline(h=mean(meanvec))
abline(v=mean(imp))
}
Problem #2: If I only input x1,x2,and x3 how do I get
the function to ingnore the 4th instead of giving me
the unused argument error?
Thanks
Derek