Hi all
I'm trying to create a matrix, A, with an unknown variable delta. The code I
have so far is:
D<-c(-1, -2/3, -1/3, 0, 1/3, 2/3, 1)
A<-matrix(NA,nrow=7,ncol=7)
for (i in 1:7)
{
for (j in 1:7)
{
A[i,j]<-exp(-((D[i]-D[j])/delta)^2)
}
}
Of course, R comes up with an error message because delta is not yet defined,
but works if I plug in a value for delta. However, I want R to use the term
delta in the matrix A, because I'm trying to estimate delta in another equation
that is written in terms of A. Can anyone help?
Many thanks
Jen
[[alternative HTML version deleted]]
______________________________________________
[email protected] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.