[R] pdredge error

2018-09-17 Thread Art U
Hello, I'm trying to use parallel computing in MuMIn package. It worked a couple month ago, but now I'm getting the error. Here is a code: #Data x1 = rnorm(1000) x2 = rnorm(1000) x3 = rnorm(1000) z = 1 + 0.5*x1 - x2 pr = 1/(1+exp(-z)) y = rbinom(1000, 1, pr) dataD = cbind(y=y, x1=x1 ,x2=x2, x3=x3

[R] Combine vectors under the names

2017-04-02 Thread Art U
Hello, Lets say I have 2 vectors: x1=c("a1"=0,"b3"=2,"e2"=-2); x2=c("c"=3,"d"=4,"f"=5); and vector of names in specific order: N=c("a1","b3","d","e2","c","f") and I want to combine them to vector C: C= a1 b3 d e2 c f 0 2 4 -2 3 5 Basically, just fill vector N with values from vector x1

[R] Correlation between continuous and binary vectors.

2017-04-01 Thread Art U
Hi, I'm trying to create number of vectors, part of them are binary and part are continuous. Is there a way in R to generate them with specific correlation between each pair? Thank you in advance. Ariel -- *I like to pretend I'm alone*. *Completely alone*. *Maybe post-apocalypse or plague*... *Wha

[R] Parallel programming.

2017-03-29 Thread Art U
Hello everyone, I have general question about parallel programming. I'm doing simulations that involves bootstrap. For now I'm using parLapply only for bootstrap part and then function "replicate" for simulations. It is very long function, so here is a short version: simfun=function(data,n,alpha

[R] Correlated variables

2017-03-15 Thread Art U
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

[R] Empirical k-quantile function

2017-02-16 Thread Art U
Hello, Suppose I have one vector of values or even matrix of those vectors and I want to calculate q_k(V/k), where V is the vector, k is a quantile and q_k is empirical k-quantile function. Finally I want to calculate Q_k=min(1, q_k) for k=(0,1). Can you please help me with this code? quantile fu

[R] Change (merge) vector by row names.

2017-02-04 Thread Art U
Hello, I have a vector of coefficients from backward selection model that looks like: [,1] (Intercept) -0.15 s1[, 1] 2.65 s1[, 2] 1.81 s1[, 5] 2.35 I'd like to get a new vector that contains zeroes for variables that were not included in the final model. For example

[R] How to do double (nested) parSapply in R?

2017-02-02 Thread Art U
Hello, I have a data orig.raw that contains 8 predictors and 1 outcome variable. I'm trying to run simulation (bootstrap) and create, let's say, 10 confidence intervals for coefficients estimated by LASSO. I did it with regular function replicate, but now I want to do it by using parallel programm