[R] correlated data

Sarah Goslee sarah.goslee at gmail.com
Wed Oct 17 16:40:33 CEST 2007


What's "properly"? What are you trying to do - you don't
ever say.

I think you need to set population=TRUE to get the result you
appear to want (sorry, that's not entirely clear in the docs, I see).

> x <- 1:100
> y <- corgen(x=x, r=.8, epsilon=.01, population=TRUE)$y
> cor(x, y)
[1,] 0.8091115

But there seem to be some more problems in your code:

> library(ecodist)
> x<-1:100
> y<-corgen(x=x, r=.8, epsilon=0.01, population=FALSE)$y
> colnames(data)<-c("x", "y")
> write.csv(data, file="artDataCorrPt8.csv")
> rm(data)

What's data? Where does it come from? If you want to
save your results, you need an extra line:
data <- cbind(x, y)

Since you never specify what data is, you will get errors,
the wrong output files, and it won't run as a script.

If you have problems with ecodist, you can always contact
me directly - I'm listed as package maintainer.


Sarah Goslee

More information about the R-help mailing list