It would have been helpful it you had posted the error message you got.

Here is what I got running your code:

Error in x.matrix[i, j] <- rnorm(5, mu[i], sig[i]) : object 'j' not found
No suitable frames for recover()

It seems you have not defined 'j' that you trying to index with.


Jim Holtman
Data Munger Guru

What is the problem that you are trying to solve?
Tell me what you want to do, not how you want to do it.


On Thu, Mar 27, 2014 at 7:31 AM, IZHAK shabsogh <[email protected]> wrote:

> i try to generate 27*5  matrix of observation using the following code but
> is given error
> kindly assist and correct the problem
>
>
> x1<-c(-1,0,1,-1,0,1,-1,0,1,-1,0,1,-1,0,1,-1,0,1,-1,0,1,-1,0,1,-1,0,1)
> x2<-c(-1,-1,-1,0,0,0,1,1,1,-1,-1,-1,0,0,0,1,1,1,-1,-1,-1,0,0,0,1,1,1)
> x3<-c(-1,-1,-1,-1,-1,-1,-1,-1,-1,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1)
> mu<-50+5*(x1^2+x2^2+x3^2)
> sig<-100+5*((x1-0.5)^2+x2^2+x3^2)
> x.matrix<-matrix(0,nrow=27,ncol=5)
> for(i in 1:27){
> x.matrix[i,j]<-rnorm(5,mu[i],sig[i])
> }
>
>
> Thanks
> Ishaq
>         [[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.
>
>

        [[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.

Reply via email to