[R] object size of a matrix and a list

2009-03-18 Thread Kyeongmi Cheon
Hello, My program calculates several variables at each iteration and some of them are integers and the rest are numeric. When I save them into a matrix, all of them are of numeric type, of course. I'm trying to find a way to save time/memory of my program and I was thinking that it might help t

[R] trouble with for loop

2008-11-05 Thread Kyeongmi Cheon
Hello, I'm having two similar problems with for loop and I would appreciate any help or comment. I want to use "for loop" to calculate series of initial values for an optimization problem. But some initial values have my function quit due to problems like calculating the inverse of singular mat

[R] nlminb--lower bound for parameters are dependent on each others

2008-07-24 Thread Kyeongmi Cheon
Hello I'm trying to solve two sets of equations (each set has four equations and all of them share common parameters) with nlminb procedure. I minimize one set and use their parameters as initial values of other set, repeating this until their parameters become very close to each other. I have

[R] system.time gives error when "=" is used for assignment (R-2.6.0)

2008-04-10 Thread Kyeongmi Cheon
Hello list, I found that system.time works correctly when I used "<-" to assign a value to a variable but when I happened to use "=" instead of "<-", R gave an error message: "Error in system.time(your argument here...)". It happened with a few functions I tried. Is this a bug or is there any circu

[R] strange behavior of my function

2008-04-01 Thread Kyeongmi Cheon
Hello, I wrote a program to convert normal distribution to trinomial distribution (three levels=0,1,2). But the first function I wrote (convert.to.trinom1) converts everything to 2. When I changed it slightly (convert.to.trinom2), it works correctly (ie. converts to 0,1, or 2). I cannot figure out

[R] parameters for lbfgsb (function for optimization)

2008-03-06 Thread Kyeongmi Cheon
Can anyone help me with lbfgsb (function for optimization)? It takes the following parameters: void lbfgsb (int n, int lmm, double *x, double *lower, double *upper, int *nbd, double *Fmin, optimfn fn, optimgr gr, int *fail, void *ex, double factr, double pgtol, int *fncount, int *grcount, int max

[R] Question on "assign(paste.."

2008-03-04 Thread Kyeongmi Cheon
Hello, I'm having trouble in using "assign(paste ..." command . I could create several dataframes following trinomial distribution using it but it could not be used to check their row means of the created dataframe. For example, the following works: probTrt=matrix(0,4,3); probTrt; #malf, death, n