[R] for loop problem

From: aat <adam_6242_at_yahoo.com>
Date: Sun 21 Jan 2007 - 04:21:36 GMT

Hello R users,

A beginners question which I could not find the answer to in earler posts.

My thought process:
Here "z" is a 119 x 15 data matrix
Step 1: start at column one, bind every column with column 1

Step2: use the new matrix, "test", in the fitCopula package
Step3: store each result in myfit, bind each result to "answer"
Step4: return "answer"


copula_est <- function(z)
{

	for(i in 1:length(z[1,]))
	{
		my.cop <- normalCopula(param = 0.5, dim = 2)
		test <- cbind(z[,1],z[,i])
		myfit[i] <- fitCopula(test,my.cop, start=0.3)
	}
	answer <- cbind(myfit[i])
	return(answer)

}

Errors received:
Error: object "test" not found

Could my syntax be incorrect, or is it a deeper faulty logic error. Thank you for your help, it is much appreciated.

aat

-- 
View this message in context: http://www.nabble.com/for-loop-problem-tf3047849.html#a8472217
Sent from the R help mailing list archive at Nabble.com.

______________________________________________
R-help@stat.math.ethz.ch 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.
Received on Sun Jan 21 15:30:53 2007

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.1.8, at Sun 21 Jan 2007 - 14:30:23 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.