1
> rbinom(5, 1, prob=prb)
[1] 1 0 1 0 1
-
David L Carlson
Department of Anthropology
Texas A&M University
College Station, TX 77840-4352
From: Art U [mailto:art.tem...@gmail.com]
Sent: Wednesday, March 15, 2017 1:14 PM
To: David L Carlson
Subject: Re: [R] Correlated variables
I h
Hi Ariel,
It all depends upon n:
n<-2
x1=rnorm(n,0,1);
x2=rnorm(n,0,1);
x3=rnorm(n,0,1);
if(x1+x2-x3>0.25){
t=rbinom(1, 1, prob=0.25)
}else{
t=rbinom(1, 1, prob=0.5)
}
n<-1
x1=rnorm(n,0,1);
x2=rnorm(n,0,1);
x3=rnorm(n,0,1);
if(x1+x2-x3>0.25){
t=rbinom(1, 1, prob=0.25)
}else{
t=rbinom(1, 1,
day, March 15, 2017 9:56 AM
To: r-help@r-project.org
Subject: [R] Correlated variables
Hi,
I'm trying to create binary variable which distribution conditioned on
other variables. That is what I did,
x1=rnorm(n,0,1);
x2=rnorm(n,0,1);
x3=rnorm(n,0,1);
if(x1+x2-x3>0.25){
t=rbinom(1, 1, prob
Hi,
I'm trying to create binary variable which distribution conditioned on
other variables. That is what I did,
x1=rnorm(n,0,1);
x2=rnorm(n,0,1);
x3=rnorm(n,0,1);
if(x1+x2-x3>0.25){
t=rbinom(1, 1, prob=0.25)
}else{
t=rbinom(1, 1, prob=0.5)
}
But I always get this the warning:
Warning messag
4 matches
Mail list logo