N <- 100
Nrep <- 5
X <- runif(N, 0, 10)
Y <- 6 + 2*X + rnorm(N, 0, 1)
X[ sample(which(Y < 15), Nrep) ] <- runif(Nrep, 15, 20)
Hope this helps,
Michael
On 3 October 2010 16:12, Hock Ann Lim wrote:
> Dear experts,
> I am a beginner of R.
> I'm looking for experts to guide me how to do programmin
Dear Hock Ann,
I am not sure of all your requirements, but this should at least get
you started. I show it by hand and also wrapped up in a function. In
the function I made two density plots that I thought might be
interesting to you, you can just delete those two lines of code if you
do not wan
Dear experts,
I am a beginner of R.
I'm looking for experts to guide me how to do programming in R in order to
randomly replace 5 observations in X explanatory variable with outliers drawn
from U(15,20) in sample size n=100. The replacement subject to y < 15.
The ultimate goal of my study is to
3 matches
Mail list logo