[R] question about mixtools package

2011-08-18 Thread Dmitrij Kudriavcev
Hello all, May be silly question, but what exactly is beta parameter in functions like regmixEM from mixtools package? I mean, how to determine this beta, if i have a set of metrics for each case? Is there a function for that? I have try to put NULL at this parameter, but function just do not wor

Re: [R] How to make array of regression objects

2011-05-18 Thread Dmitrij Kudriavcev
Thank you, Ista, that exactly, what i was looking for :) Regards, Dmitrij Kudriavcev 2011/5/18 Ista Zahn > Hi Dmitrij, > I think the usual way is to store the results in a list: > > o <- list() > o[[1]] <- lrm(...) > o[[2]] <- lrm(...) > o[[...]] <-lrm(...) &g

[R] How to make array of regression objects

2011-05-17 Thread Dmitrij Kudriavcev
et_object <- function(obj_name, nModel) { eval (parse(text=paste("o <- ", obj_name, nModel, sep=""))) o } Is there a better way to do it? I have try to store it in the matrix using data.frame(), but object become destroyed after that and predict() function do not recogni

Re: [R] How to copy data from data.frame to matrix

2011-03-04 Thread Dmitrij Kudriavcev
; >> >> 2011/3/4 Ivan Calandra >> >> Hi, >>> >>> Let's say your data.frame is called df: >>> df<- data.frame(a=rnorm(10), b=rnorm(10)) >>> data.matrix<- as.matrix(df) >>> >>> This should work, but be careful wi

Re: [R] How to copy data from data.frame to matrix

2011-03-04 Thread Dmitrij Kudriavcev
Hello, no. I need to change data format, so i can build covariance matrix on it Cheers, Dima 2011/3/4 Alberto Negron > Can't you just convert you df as follow matrix <- as.matrix(s) ? > > Double check it as I am a newbie too. :-) > > Regards, > > Alberto >

Re: [R] How to copy data from data.frame to matrix

2011-03-04 Thread Dmitrij Kudriavcev
> This should work, but be careful with coercion if you have different modes > in your data.frame > > HTH, > Ivan > > PS: next time, provide a reproducible example, using dput() for example > > Le 3/4/2011 07:08, Dmitrij Kudriavcev a écrit : > >> Hello >> >

[R] How to copy data from data.frame to matrix

2011-03-04 Thread Dmitrij Kudriavcev
Hello I'm a new in R I have a large data.frame "s" (this is actualy just a table in mysql) : > names(s) [1] "symbols", "day", "value" I need to convert it to simple matrix. I have define this matrix like this: > data.matrix <- matrix(nrow=nDays, ncol=nSymbols, dimnames=list(days, symbols)) the

[R] How to convert SEXP to double

2010-09-28 Thread Dmitrij Kudriavcev
Hello All, A simple question. I get some return from the R in my C++ program (via Rcpp package). The result come, as SEXP and it should be a simple numeric variable. How to convert it to double? The code, what i use: stringstream ss; ss << "p <- predict(fit_ar11, n.ahead = 2, doplot=FALSE);"

[R] Error in solve.default

2010-07-03 Thread Dmitrij Kudriavcev
Hello I use c++ program, what call R-project to solve matrix multiplications. Some times, I get an error in R: Error in solve.default(V, R) : system is computationally singular: reciprocal condition number = 2.20828e-19 Execution halted After that, the program crash. The code, what i execute,

Re: [R] Matrix operations

2010-06-28 Thread Dmitrij Kudriavcev
But isn't it change multiplication order? WBR Dima 2010/6/29 > Since X is a vector, then > > A <- sum(X, solve(V, X)) > > is probably slightly better here. > > -Original Message- > From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-pro

[R] Matrix operations

2010-06-28 Thread Dmitrij Kudriavcev
Hello I have a quick question. I need to compute matrix in R, like A <- t(X) %*% solve(V) %*% X, where X is a vector and V is a matrix This code works, but now i want to optimize it. I have try: A <- crossprod(X, solve(V)) %*% X Is there another, better way? WBR Dima [[alternative HT