[R] set.cor/mat.regress
Andrea Lamont
alamont082 at gmail.com
Thu Jan 8 01:19:11 CET 2015
I am having a problem with the function mat.regress in the psych package
that I was hoping someone would be able to give guidance on.
I have a correlation matrix that is [76,76] with the first column
representing the Y variable, the rest are the Xs. This is what my data
looks like:
m=runif(5776,-1,1)
mdat <- matrix(m, nrow = 76, ncol = 76, byrow = TRUE)
diag(mdat) <- 1
I am trying to obtain beta weights/regression coefficients from this
correlation matrix.
When I run:
set.cor(y=1, x=c(2:76),data=mdat)
or mat.regrss(y=1, x=c(2:76),data=mdat)
I get odd errors. Most recently:
set.cor(y=1, x=c(2:76),data=mdat) yields
Error in array(x, c(length(x), 1L), if (!is.null(names(x))) list(names(x),
:
'data' must be of a vector type, was 'NULL'
I have tried converting my matrix to a vector (as.vector). Still got
errors. Another common error I am getting is that the subscript not being
bound. I tried other options like square=FALSE to no avail.
It seems like such a straightforward function, I'm not sure what I'm doing
wrong.
Any help is appreciated.
Thanks
Andrea
--
Andrea Lamont, PhD
Post-Doctoral Fellow
University of South Carolina
Columbia, SC 29208
*Please consider the environment before printing this email.*
[[alternative HTML version deleted]]
More information about the R-help
mailing list