[R] Using a covariance matrix as input to relaimpo package
Ku!Rt
Kurt.Salmela at maritz.com
Mon Dec 15 22:20:08 CET 2008
I'm having trouble getting the relaimpo package to use a covariance matrix as
input. I'm getting an error message that reads as follows:
Error in eval(m$weights, data, parent.frame()) :
numeric 'envir' arg not of length one
I'm guessing there is something wrong with the structure of my covariance
matrix, but it looks fine to me. Pardon my R ignorance if this is an easy
error message to decipher. Below is my code.
# calculate covariance matrix from survey respondent data using pairwise
deletion
covmatrx =
cov(respdata[,c("V0007","V0029","V0031","V0032","V0034","V0035","V0036")],
use = "pairwise")
>
# show the resulting covariance matrix
> covmatrx
V0007 V0029 V0031 V0032 V0034
V0035 V0036
V0007 0.5713399 0.4207775 0.4144349 0.4178506 0.3679451 0.4073394 0.3847520
V0029 0.4207775 0.7043533 0.5567348 0.5877138 0.5052262 0.5627425 0.5289048
V0031 0.4144349 0.5567348 0.6335806 0.5735619 0.4971775 0.5453335 0.5179622
V0032 0.4178506 0.5877138 0.5735619 0.6922080 0.5206816 0.5638391 0.5579144
V0034 0.3679451 0.5052262 0.4971775 0.5206816 0.5369755 0.4925769 0.4754083
V0035 0.4073394 0.5627425 0.5453335 0.5638391 0.4925769 0.5977329 0.5098200
V0036 0.3847520 0.5289048 0.5179622 0.5579144 0.4754083 0.5098200 0.6480419
# try the lmg method of relative importance
> imps1 = calc.relimp(V0007 ~ V0029 + V0031 + V0032 + V0034 + V0035 + V0036,
> data=covmatrx, type="lmg", rela=TRUE)
Error in eval(m$weights, data, parent.frame()) :
numeric 'envir' arg not of length one
>
--
View this message in context: http://www.nabble.com/Using-a-covariance-matrix-as-input-to-relaimpo-package-tp21022295p21022295.html
Sent from the R help mailing list archive at Nabble.com.
More information about the R-help
mailing list