Re: [R] R parallel / foreach - aggregation of results

2015-08-01 Thread Martin Spindler
. Juli 2015 um 18:22 Uhr Von: "jim holtman" An: "Martin Spindler" Cc: "r-help@r-project.org" Betreff: Re: [R] R parallel / foreach - aggregation of results Try this chance to actually return values:     library(doParallel) Simpar3 <- function(n1) {    L2distan

[R] R parallel / foreach - aggregation of results

2015-07-31 Thread Martin Spindler
Dear all, when I am running the code attached below, it seems that no results are returned, only the predefined NAs. What mistake do I make? Any comments and help is highly appreciated. Thanks and best, Martin Simpar3 <- function(n1) { L2distance <- matrix(NA, ncol=n1, nrow=n1) data <- rn

Re: [R] R parallel - slow speed

2015-07-31 Thread Martin Spindler
t, Martin     Gesendet: Donnerstag, 30. Juli 2015 um 15:28 Uhr Von: "jim holtman" An: "Jeff Newmiller" Cc: "Martin Spindler" , "r-help@r-project.org" Betreff: Re: [R] R parallel - slow speed I ran a test on my Windows box with 4 CPUs.  THere were 4 RScript processes

Re: [R] R parallel - slow speed

2015-07-31 Thread Martin Spindler
Uhr Von: "Jeff Newmiller" An: "Martin Spindler" , "r-help@r-project.org" Betreff: Re: [R] R parallel - slow speed Parallelizing comes at a price... and there is no guarantee that you can afford it. Vectorizing your algorithms is often a better approach. Microbenchma

[R] R parallel - slow speed

2015-07-30 Thread Martin Spindler
Dear all, I am trying to parallelize the function npnewpar given below. When I am comparing an application of "apply" with "parApply" the parallelized version seems to be much slower (cf output below). Therefore I would like to ask how the function could be parallelized more efficient. (With in

Re: [R] Problem with predict.lm()

2015-04-29 Thread Martin Spindler
Thank you! I think I now understand where the problem was. Best, Martin     Gesendet: Mittwoch, 29. April 2015 um 16:50 Uhr Von: "David L Carlson" An: "Martin Spindler" , "r-help@r-project.org" Betreff: RE: [R] Problem with predict.lm() Since you passed a matrix

Re: [R] Problem with predict.lm()

2015-04-29 Thread Martin Spindler
on: "ARNAB KR MAITY" An: "Martin Spindler" , "r-help@r-project.org" Betreff: Re: [R] Problem with predict.lm() Hi,   It seems to be working in my R. Although it is throwing the warning message   Warning message:   'newdata' had 200 rows but vari

[R] Problem with predict.lm()

2015-04-29 Thread Martin Spindler
Dear all,   the following example somehow uses the "old data" (X) to make the predictions, but not the new data Xnew as intended.   y <- rnorm(100) X <- matrix(rnorm(100*10), ncol=10) lm <- lm(y~X) Xnew <- matrix(rnorm(100*20), ncol=10) ynew <- predict(lm, newdata=as.data.frame(Xnew)) #prediction

[R] Using openBLAS in R under Unix / Linux

2014-08-28 Thread Martin Spindler
Dear all, I would like to us openBLAS in R under Linux / Unix. Which steps do I have to undertake? Does someone know a detailed description? (I found some sources on the web, but none was really helpful for me.) Thanks and best, Martin [[alternative HTML version deleted]] __

[R] Standardisation of variables with Lasso (glmnet)

2014-02-13 Thread Martin Spindler
Dear all, I am working with glmnet but the problem arises also in all other Lasso implementations: It is ususally recommended to standardize the variables / use intercept and this works well with the implemented options: x <- matrix(rnorm(1), ncol=50) y <- rnorm(200)

[R] Negative Binomial Regression - glm.nb

2013-02-27 Thread Martin Spindler
Dear all, I would like to ask, if there is a way to make the variance / dispersion parameter $\theta$ (referring to MASS, 4th edition, p. 206) in the function glm.nb dependent on the data, e.g. $1/ \theta = exp(x \beta)$ and to estimate the parameter vector $\beta$ additionally. If this is not

[R] Splitting up of a dataframe according to the type of variables

2012-12-17 Thread Martin Spindler
Dear R users, I have a dataframe which consists of variables of type numeric and factor. What is the easiest way to split up the dataframe to two dataframe which contain all variables of the type numeric resp. factors? Thank you very much for your efforts in advance! Best, Martin

[R] Function for Generating all Permutations with Repetition

2012-03-05 Thread Martin Spindler
Dear all, I am looking for a function in R which returns all possible permutations of an object x with r number of repitions. For example If x <- c(0,1) and r <-3 the result should be 0 0 0 0 0 1 0 1 0 0 1 1 1 0 0 1 0 1 1 1 0 1 1 1 and consist of 2^3=8 elements. Unfortunately, I have found on

[R] non-finite finite-difference value

2012-02-23 Thread Martin Spindler
Dear all, when applying the optim function the following error occured "non-finite finite-difference value" Therefore I would like to ask how one can try to handle such a problem and which strategies have proven useful. (There is only litte guidance on the help list for this kind of problem.)

[R] problem with as.Date

2011-10-22 Thread Martin Spindler
Dear all, I would like to convert the first column of a dataframe to a date (original format: year (4 digits) and month (last 2 digits)) >str(dat_FF) 'data.frame': 1022 obs. of 4 variables: $ date : int 192607 192608 192609 192610 192611 192612 192701 192702 192703 192704 ... $ Rm.Rf: num

[R] package VGAM: vglm.fit()

2011-06-16 Thread Martin Spindler
Dear all, I am estimating a bivariate probit model using the package VGAM: fit1 = vglm(cbind(y1, y2) ~ x1+x2, binom2.rho, data=dat, trace=TRUE) I would like to estimate this via the method vglm.fit (in an analogous way as lm.fit for lm or glm.fit for glm). Unfortunately my trials did no

[R] conversion of matrix into list

2011-06-01 Thread Martin Spindler
Dear all, I have a matrix X which consists of 2 columns. I would like to convert this matrix into a list where every entry of the list consists of a single row of the matrix. Does anyone have a suggestions how to manage this? Thank you for your efforts in advance! Best, Martin

[R] partial evaluation of a function with several arguments

2011-02-07 Thread Martin Spindler
Dear all, I have the following problem: add <- function(x,y) {x+y} What is the easiest / most elegant way to create a new function (e.g. with the name "addev") that sets the second argument of the function "add" to a fixed value (e.g. y=3), i.e. addev <- add(x,3). But this does not work. Than

Re: [R] subset with two factors

2010-12-10 Thread Martin Spindler
Hey Michael, Thank you very much. It works! Best, Martin Original-Nachricht > Datum: Fri, 10 Dec 2010 22:35:56 +1100 > Von: Michael Bedward > An: Martin Spindler > CC: r-help@r-project.org > Betreff: Re: [R] subset with two factors > Hello Martin, &g

[R] subset with two factors

2010-12-10 Thread Martin Spindler
Dear all, I have a dataframe of the following strucutre numacc_b coverage_b Geschlecht GG 10 1 W A 20 1 M A 30 1 M B 40 1 M B 50 1 W A 60 1

[R] question concerning VGAM

2010-07-04 Thread Martin Spindler
Hello everyone, using the VGAM package and the following code library(VGAM) bp1 <- vglm(cbind(daten$anzahl_b, daten$deckung_b) ~ ., binom2.rho, data=daten1) summary(bp1) coef(bp1, matrix=TRUE) produced this error message: error in object$coefficients : $ operator not defined for

[R] linear predicted values of the index function in an ordered probit model

2010-06-28 Thread Martin Spindler
Hello, currently I am estimating an ordered probit model with the function polr (MASS package). Is there a simple way to obtain values for the prediction of the index function ($X*\hat{\beta}$)? (E..g. in the GLM function there is the linear.prediction value for this purpose). If not, i