Dear all,
I would like to simulate some data: a bivariate random vector (v,u) which is bivariate normal, but with a correlation which depends on a third variable x.
Suppose I have 10 x 1 vector of xis. I can define the correlation as
p(xi)=[exp(xi)-1]/[exp(xi)+1]
such that it each p(xi) with the interval [-1,1].
Then I would like to draw a bivariate random vector of size 10 (v,u) with correlation matrix (1 , p(xi) \ p(xi) , 1). Essentially I would like to have a distinct Corr(vi,ui)=p(xi).
Anyone has any ideas?
Thank you!
Riju
Related Posts with How to draw bivariate random vector (v,u) which is bivariate normal, but with a correlation which depends on a third variable x?
questions about model selection with lassopackDear STATA users, Sorry to ask you 3 simple questions. 1.When we used lassopack for selecting predi…
Generate with tempfilesI used Stata tempfile code from one of the earlier posts to append multiple years of NHIS mortality …
Is there a way to rename large number of variables with a single command? (Details)I have a ton of variables, for example, var1_m, var2_m, var3_m, etc. I want to turn them into var1_2…
Standard errors using Frisch-Waugh-Lovell theoremHi, I need to implement the Frisch Waugh-Lovell-theorem in Stata 15 MP (64-bit) in the context of a …
Looking for examples of OSIRIS dictionaries and dataDear Statalisters, I am writing a custom converter of data from OSIRIS dictionaries and need exampl…
Subscribe to:
Post Comments (Atom)
0 Response to How to draw bivariate random vector (v,u) which is bivariate normal, but with a correlation which depends on a third variable x?
Post a Comment