Hello guys! Sorry to bother with such a question I was trying to generate a monte carlo simulation with heteroskedasticity errors. but I am not sure if the command line that I had wrote is quite correct. the type of heteroskedasticity that I want to create is such as var(e) = var(x^4)
I began my work with this x<- rnorm (100, 2,0.4) # generating an indepedent random variable e<- rnorm(100,0,x^2) # generating the error term y.fitted<- 0.5*(x) +3 y<- y.fitted+e And then I wrote an for loop code which could give me the results of a t-test. It seems that the simulation worked good because the main result is that the t-test was no longer meanfull (as it is expected) But my main doubt is if this code was capable to generate the type of heteroskedasticity that I wanted. I tried to understand how the rnorm function generates the numbers but i could not grab much.... So could anyone help me telling if this kind of work is okay? or is there any moree inteligent way to do the job? thanks!!! [[alternative HTML version deleted]] ______________________________________________ R-help@r-project.org 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.