[R] Multiple Imputation / Non Parametric Models / Combining Results

2006-12-08 Thread Simon P. Kempf
Dear R-Users, The following question is more of general nature than a merely technical one. Nevertheless I hope someone get me some answers. I have been using the mice package to perform the multiple imputations. So far, everything works fine with the standard regressions analysis.

[R] question about apply function

2006-12-08 Thread Andris Jankevics
Dear R-Users, For example i have a data matrix with five samples and three variables. DATA - matrix(c(1,1,1,2,2,2,3,3,3,4,4,4,5,5,5),nrow=5,ncol=3,byrow=TRUE) colnames (DATA) - c(V1,V2,V3) rownames (DATA) - c(S1,S2,S3,S4,S5) I want to normalize all samples to same sum of variables: NormFun -

Re: [R] question about apply function

2006-12-08 Thread Dimitris Rizopoulos
in this case you may use something like the following: DATA - matrix(1:5, 5, 3) dimnames(DATA) - list(c(S1,S2,S3,S4,S5), c(V1,V2,V3)) # DATA / rowSums(DATA) DATA / rep(colSums(DATA), each = nrow(DATA)) I hope it helps. Best, Dimitris Dimitris Rizopoulos Ph.D. Student

Re: [R] filled.contour and NA's

2006-12-08 Thread Gustaf Rydevik
On 11/29/06, antonio rodriguez [EMAIL PROTECTED] wrote: Hi, I'm trying to do a filled.contour plot where some points are labelled as NA. How do I could plot this kind of graphics, so NA points are coloured black, keeping the levels of remaining points. NA's values represent land points

[R] lattice: defining an own function using args for formula and groups

2006-12-08 Thread Wolfram Fischer
x.fun - function( formula, data ) dotplot( formula, data ) x.grp - function( formula, groups, data ) dotplot( formula, groups, data ) data( barley ) x.fun( variety ~ yield | site, data=barley ) # no problem dotplot( variety ~ yield | site, groups=year, data=barley ) # no problem x.grp(

[R] Aggregate?

2006-12-08 Thread Gustaf Rydevik
Hi All, I think i'm failing to undersatnd how aggregate() is supposed to work. example: test1-sample(c(0,1),100,replace=T) test2-sample(letters,100,replace=T) aggregate(test1,list(test2),sum) Error in data.frame(w, lapply(y, unlist, use.names = FALSE)) : arguments imply differing

[R] Re : formula format for parameter estimation

2006-12-08 Thread justin bem
see nlm or optim Justin BEM Elève Ingénieur Statisticien Economiste BP 294 Yaoundé. Tél (00237)9597295. - Message d'origine De : Wayne Delport [EMAIL PROTECTED] À : r-help@stat.math.ethz.ch Envoyé le : Vendredi, 8 Décembre 2006, 8h27mn 44s Objet : [R] formula format for parameter

[R] How to plot two variables in the same qqnorm-plot?

2006-12-08 Thread Jenny persson
Dear all, I have two variables called c2 and c3 and want to plot these variables in the same qqnorm-plot with two different symbols or colors to distinguish them so I can easily compare the variables aginst each other. How can I do in R? I only manage to do two separated qqnorn-plots.

Re: [R] Aggregate?

2006-12-08 Thread Ingmar Visser
It does that for me without errors ... (R 2.3.1 on Mac OSX 10.4.8) Best, Ingmar From: Gustaf Rydevik [EMAIL PROTECTED] Date: Fri, 8 Dec 2006 12:58:01 +0300 To: r-help@stat.math.ethz.ch Subject: [R] Aggregate? Hi All, I think i'm failing to undersatnd how aggregate() is supposed to

Re: [R] How to plot two variables in the same qqnorm-plot?

2006-12-08 Thread Dimitris Rizopoulos
try this: z1 - rnorm(100) z2 - rt(100, 3) ## q1 - qqnorm(z1, plot.it = FALSE) q2 - qqnorm(z2, plot.it = FALSE) plot(range(q1$x, q2$x), range(q1$y, q2$y), type = n) points(q1) points(q2, col = red, pch = 3) I hope it helps. Best, Dimitris Dimitris Rizopoulos Ph.D. Student

[R] MAXIMIZATION WITH CONSTRAINTS

2006-12-08 Thread [EMAIL PROTECTED]
Dear R users, I’m a graduate students and in my master thesis I must obtain the values of the parameters x_i which maximize this Multinomial log–likelihood function log(n!)-sum_{i=1]^4 log(n_i!)+sum_ {i=1}^4 n_i log(x_i) under the following constraints: a) sum_i x_i=1, x_i=0, b)

Re: [R] lattice: defining an own function using args for formula and groups

2006-12-08 Thread Gabor Grothendieck
Don't know of a more straight forward way but this works. It constructs a new call to bwplot from the one to x.grp2 and evaluates it in the parent environment: library(lattice) x.grp2 - function(x, groups, data) { cl - match.call() cl[[1]] - as.name(bwplot) eval.parent(cl) } x.grp2(

[R] fmincon equivalent in R

2006-12-08 Thread Arun Kumar Saha
Dear all R users, I am wondering if there are any function for Constraint optimization in R. Especially i am looking for a R - equivalent of fmincon function in MATLAB. Thanks and regards, Arun [[alternative HTML version deleted]] __

[R] A smal fitting problem...

2006-12-08 Thread Kåre Edvardsen
Dear R-helpers, I'm for sure not familiar with R, but it seem like a nice sofware tool, so I've decided to try using it. Here is my problem I just can't figure out: I'd like to do least square fit of a straight horizontal (a = 0) line y = ax + b through some data points x = (3,4,5,6,7,8) y =

Re: [R] Aggregate?

2006-12-08 Thread Petr Pikal
Hi look to your workspace by ls(). I bet there is some mismatch in variables as your example works for me without any error. You probably redefined sum function. test1-sample(c(0,1),100,replace=T) test2-sample(letters,100,replace=T) aggregate(test1,list(test2),sum) Group.1 x 1b

[R] missing factor levels in a lattice barchart panel cause unexpected failure

2006-12-08 Thread Alex Brown
Hi all - I'm trying to generate lattice barchart graphs with missing values, and came across the following: This does not run. I would expect it to: library(lattice) D = data.frame(X=1, Y=factor(letters[2], letters[1:2])) barchart(~ X, D, groups=Y) Error in grid.Call.graphics(L_rect, x$x,

Re: [R] svm plot question

2006-12-08 Thread David Meyer
Aimin: 1) Please do not spam the r-help list---one request per issue (and two private mails to the code author) really suffice. Not all contributors to the R-project are on-line 24/24, and have time to provide immediate answers. 2) The error occurs because plot.svm() currently does not set valid

Re: [R] A smal fitting problem...

2006-12-08 Thread Eik Uni
If you really want to fit a horizontal line then the best estimate (meaning least squares) for b is mean(y), regardless of the actual x values, which becomes clear if you look at your design matrix / regressor matrix . In general least squares regression could be done with lsfit(). In your

Re: [R] plot.svm

2006-12-08 Thread Liaw, Andy
Try debug(e1071:::plot.svm) and then re-run your plot command, stepping through one line at a time and see where it fails. Andy From: Aimin Yan where is plot.svm method? I just find plot(svm, data, formula) method Aimin __

Re: [R] A smal fitting problem...

2006-12-08 Thread David Barron
b = mean(y) On 08/12/06, Kåre Edvardsen [EMAIL PROTECTED] wrote: Dear R-helpers, I'm for sure not familiar with R, but it seem like a nice sofware tool, so I've decided to try using it. Here is my problem I just can't figure out: I'd like to do least square fit of a straight horizontal (a

Re: [R] Simulation in R - Part 2

2006-12-08 Thread Petr Pikal
Hi from write.csv help page: x the object to be written, preferably a matrix or data frame. If not, it is attempted to coerce x to a data frame. So array is not a kind of object which can be saved as you want without some complication. Basically it is a plain vector with dim attributes and

Re: [R] fmincon equivalent in R

2006-12-08 Thread Ben Bolker
Arun Kumar Saha arun.kumar.saha at gmail.com writes: Dear all R users, I am wondering if there are any function for Constraint optimization in R. Especially i am looking for a R - equivalent of fmincon function in MATLAB. Thanks and regards, Arun Unfortunately, the built-in

[R] Remove from a string

2006-12-08 Thread Katharina Vedovelli
Hi all! I have lots of functions called in the following pattern 'NameOfFunctionNumber' where the name always stays the same and the number varies from 1 to 98. Another function which I run in advance returns the number of the function which has to be called next. Now I want to combine

Re: [R] Remove from a string

2006-12-08 Thread jim holtman
Try using 'get' to return the object specified as a character string: f1-function()1 f2 - function()2 z - 'f2' z [1] f2 get(z)() [1] 2 On 12/8/06, Katharina Vedovelli [EMAIL PROTECTED] wrote: Hi all! I have lots of functions called in the following pattern 'NameOfFunctionNumber'

[R] dyn.load and function calls without 'PACKAGE' argument

2006-12-08 Thread jhallman
I'm writing a package that interfaces to the FAME database, via a library of compiled C routines accessible through a Linux .so file. My .onLoad() function loads the .so like this: dyn.load(/opt/fame/timeiq/lib/linux_x86/libjchli.so, local = F) and after that I also load my own fame.so via

Re: [R] Remove from a string

2006-12-08 Thread Scionforbai
If I understand what you need, Number=2 x - paste(NameOfFunction,as.character(Number),sep=) x [1] NameOfFunction2 And you can use do.call(x, ...) to get your function. Hope it helps, Scionforbai __ R-help@stat.math.ethz.ch mailing list

[R] Re : A smal fitting problem...

2006-12-08 Thread justin bem
May be you are also not familiar with statistic. the solution of min \sum_{i=1}^{n} (y_{i}-b)^{2} is the mean. So the solution is b-mean(y) Justin BEM Elève Ingénieur Statisticien Economiste BP 294 Yaoundé. Tél (00237)9597295. - Message d'origine De : Kåre Edvardsen [EMAIL

Re: [R] Remove from a string

2006-12-08 Thread Dimitris Rizopoulos
try this: f1 - function(x) x + 1 f2 - function(x) x + 2 f3 - function(x) x + 3 ### FunNam - f1 eval(call(FunNam, x = 1:5)) FunNam - f2 eval(call(FunNam, x = 1:5)) FunNam - f3 eval(call(FunNam, x = 1:5)) I hope it helps. Best, Dimitris Dimitris Rizopoulos Ph.D. Student

Re: [R] Remove from a string

2006-12-08 Thread Marc Schwartz
On Fri, 2006-12-08 at 14:57 +0100, Katharina Vedovelli wrote: Hi all! I have lots of functions called in the following pattern 'NameOfFunctionNumber' where the name always stays the same and the number varies from 1 to 98. Another function which I run in advance returns the number of the

[R] JOB: R/S programmers at Mango Solutions (UK)

2006-12-08 Thread Romain Francois
Hello, Due to the continued growth of Mango Solutions, we are now inviting applications for the following positions: * Senior R/S Programmer: http://www.mango-solutions.com/company/jobuk13.html * R/S Programmer: http://www.mango-solutions.com/company/jobuk14.html To view all available

Re: [R] A smal fitting problem...

2006-12-08 Thread Michael Kubovy
On Dec 8, 2006, at 7:42 AM, David Barron wrote: b = mean(y) On 08/12/06, Kåre Edvardsen [EMAIL PROTECTED] wrote: Dear R-helpers, I'm for sure not familiar with R, but it seem like a nice sofware tool, so I've decided to try using it. Here is my problem I just can't figure out: I'd

[R] Sweave and warning messages

2006-12-08 Thread Michael Kubovy
How does one tell Sweave() to include analysis warning messages in the verbatim output? _ Professor Michael Kubovy University of Virginia Department of Psychology USPS: P.O.Box 400400Charlottesville, VA 22904-4400 Parcels:Room 102Gilmer Hall

[R] Hallo.

2006-12-08 Thread Dr.Peter Maluba
Dr. PETER MALUBA/CHRIS NISSEN ASSOCIATES SOLICITORS ADVOCATES GABORONE. BOTSWANA. Hallo, Mein Name ist Dr. Peter Maluba, bin ein 50 jähriger Anwalt aus Gaborone, Botswana. Einer meiner 15 Jährigen Klienten ,ein Deutscher Namens Gunter Haymann, welcher über 18 Jahre für eine Diamanten

Re: [R] Remove from a string

2006-12-08 Thread Greg Snow
The best approach is probably to load all of your functions into a list: myfunctions - list() myfunctions[[1]] - NameOfFunction1 myfunctions[[2]] - NameOfFunction2 ... Or myfunctions - list() for (i in 1:98){ + myfunctions[[i]] - get( paste('NameOfFunction',i,sep='') ) + } Then you can

[R] how to create data.frame with dynamic count of values

2006-12-08 Thread Knut Krueger
Hello R-Group I found how to fill the data.frame - http://finzi.psych.upenn.edu/R/Rhelp02a/archive/70843.html N1 - rnorm(4) N2 - rnorm(4) N3 - rnorm(4) N4 - rnorm(4) X1 - LETTERS[1:4] ### nams - c(paste(N, 1:4, sep = ), X1) dat - data.frame(lapply(nams, get)) names(dat) - nams

Re: [R] Remove from a string

2006-12-08 Thread Bert Gunter
I second Marc's comments below, but for amusement, another alternative to the (undesirable) eval(call()) construction is: foo-function(x)x^2 get(foo)(1:5) [1] 1 4 9 16 25 I believe this is equally undesirable, however, and as Marc said, making your function a function of two arguments or

[R] dynamic panel data estimation

2006-12-08 Thread pchen
Hello every one, is there an R package that can handle dynamic panel data model aviablable ? thank you for help chen __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide

Re: [R] MAXIMIZATION WITH CONSTRAINTS

2006-12-08 Thread Thomas Lumley
On Fri, 8 Dec 2006, [EMAIL PROTECTED] wrote: Dear R users, I??m a graduate students and in my master thesis I must obtain the values of the parameters x_i which maximize this Multinomial log??likelihood function log(n!)-sum_{i=1]^4 log(n_i!)+sum_ {i=1}^4 n_i log(x_i) under the following

[R] Solve non linear system of equations

2006-12-08 Thread Paulino Perez Rodriguez
Hello, how do Ito solve a non linear system of equations in R? -- Este mensaje ha sido analizado por MailScanner en busca de virus y otros contenidos peligrosos, y se considera que está limpio. __ R-help@stat.math.ethz.ch mailing list

[R] Constraint Optimization problem.

2006-12-08 Thread Arun Kumar Saha
Dear all R users, I have a optimization problem like this: f(x,y) is a function with two variables, x, and y. Variable x is unbounded but y lies between [-10, 10]. I want to minimize f(x,y) subject to a constraint x + y 5. Can anyone tell me which R function should I use. I already gone

Re: [R] filled.contour and NA's

2006-12-08 Thread antonio rodriguez
Hi Gustaf I'm having the same issue myself. What I've ended up doing is replacing NA's with a big negative value, define levels as one color for negative values, and a regular scale above. How to define 'levels' as one color for negative values and a regular scale above? I don't know how

Re: [R] how to create data.frame with dynamic count of values

2006-12-08 Thread Don MacQueen
I don't understand what you're asking for. But if your goal is to create N1 through N15 in order to use them to fill a data frame, then it can be much simpler: items - 15 VarSize - 10 tmp - matrix(0,nrow=VarSize,ncol=items) tmp - data.frame(tmp) names(tmp) - paste('N',seq(items),sep='') ## of

[R] Paste function and backslash

2006-12-08 Thread Szymon Wlazlowski
Dear useRs, calls and results below: paste(\ \n) [1] \n *but* paste(\ \N) [1] N Question: Is that by design? If so, how can I obtain simple LaTeX-type: [1] \N version platform i386-pc-linux-gnu arch i386 os linux-gnu system i386, linux-gnu status major

Re: [R] svm plot question

2006-12-08 Thread Aimin Yan
thanks, I did get this plot. Before I have this problem, I did get a plot by my code. However after I change a little my code. it doesn't work. It is pity not saving my original code. Now the question is the plot I get using your code is different from what I got before. Moreover I did remember I

Re: [R] Paste function and backslash

2006-12-08 Thread Roger Bivand
On Fri, 8 Dec 2006, Szymon Wlazlowski wrote: Dear useRs, calls and results below: paste(\ \n) [1] \n *but* paste(\ \N) [1] N Question: Is that by design? If so, how can I obtain simple LaTeX-type: [1] \N FAQ 7.37:

[R] how to create data.frame with dynamic count of values

2006-12-08 Thread Knut Krueger
Hello R-Group I found how to fill the data.frame - http://finzi.psych.upenn.edu/R/Rhelp02a/archive/70843.html N1 - rnorm(4) N2 - rnorm(4) N3 - rnorm(4) N4 - rnorm(4) X1 - LETTERS[1:4] ### nams - c(paste(N, 1:4, sep = ), X1) dat - data.frame(lapply(nams, get)) names(dat) - nams

[R] any way to make the code more efficient ?

2006-12-08 Thread Leeds, Mark \(IED\)
The code bekow works so this is why I didn't include the data to reproduce it. The loops about 500 times and each time, a zoo object with 1400 rows and 4 columns gets created. ( the rows represent minutes so each file is one day worth of data). Inside the loop, I keep rbinding the newly created

[R] question for if else

2006-12-08 Thread Aimin Yan
I have a data set like this I want to assign outward to Y if sc 90 and assign inward to Y if sc=90. then cbind(p1982,Y) to get like these p aa as ms cur sc Y 1 154l_aa ARG 152.04 108.83 -0.1020140 92.10410 inward 2 154l_aa THR 15.86 28.32 0.2563560 103.67100inward 3 154l_aa ASP 65.13

Re: [R] any way to make the code more efficient ?

2006-12-08 Thread Ravi Varadhan
Using rbind almost always slows things down significantly. You should define the objects aggfxdata and fullaggfxdata before the loop and then assign appropriate values to the corresponding rows and/or columns. Ravi.

Re: [R] any way to make the code more efficient ?

2006-12-08 Thread Leeds, Mark \(IED\)
ravi : I appreciate your help but could you be a little more specific about what you mean ? I can just stack aggfxdata below the current full one ( the rbind works out the ordrering by date because it's a zoo object ) so it's not a question of where to put the new one. It's a question of how to

[R] (no subject)

2006-12-08 Thread Aimin Yan
I have a data set like this: if I want to less than 20 obs from this data set. How can I do these? str(p1982) 'data.frame': 465979 obs. of 6 variables: $ p : Factor w/ 1982 levels 154l_aa,1A0P_aa,..: 1 1 1 1 1 1 1 1 1 1 ... $ aa : Factor w/ 19 levels ALA,ARG,ASN,..: 2 16 4 5 18 3 19

Re: [R] (no subject)

2006-12-08 Thread jim holtman
p1982[sample(nrow(p1982),20),] On 12/8/06, Aimin Yan [EMAIL PROTECTED] wrote: I have a data set like this: if I want to less than 20 obs from this data set. How can I do these? str(p1982) 'data.frame': 465979 obs. of 6 variables: $ p : Factor w/ 1982 levels

Re: [R] any way to make the code more efficient ?

2006-12-08 Thread Charles C. Berry
Save your intermediate results as a list of matrices. Then rbind them all at once using do.call. It looks like this will save 23 seconds (see below), if you are running on a PC like mine (AMD 2GHz, WinXP ). But I wonder, if 23 a mere seconds is all you save is this really worth worrying

Re: [R] any way to make the code more efficient ?

2006-12-08 Thread Liaw, Andy
I don't know about efficiency, but at least for readability, you may want to do the following: 1. Indent your code. 2. Create a list of appropriate length, and populate the list with objects you're creating in the loop. 3. After the loop, use do.call(rbind, list). HTH, Andy From: Leeds, Mark

Re: [R] question for if else

2006-12-08 Thread jim holtman
If p1982 is a data.frame: p1982$Y - ifelse(p1982$sc90, 'inward', 'outward') If it is a matrix p1982 - cbind(p1982, Y=ifelse(p1982[,'sc']90, 'inward', 'outward')) On 12/8/06, Aimin Yan [EMAIL PROTECTED] wrote: I have a data set like this I want to assign outward to Y if sc 90 and assign

Re: [R] question for if else

2006-12-08 Thread jim holtman
Hopefully it is a dataframe or else you matrix will be converted to character; forgot that when I sent it. On 12/8/06, jim holtman [EMAIL PROTECTED] wrote: If p1982 is a data.frame: p1982$Y - ifelse(p1982$sc90, 'inward', 'outward') If it is a matrix p1982 - cbind(p1982,

Re: [R] how to create data.frame with dynamic count of values

2006-12-08 Thread jim holtman
Consider using a list: N - list() for (i in 1:15) N[[paste(N, i, sep='')]] - numeric(10) N $N1 [1] 0 0 0 0 0 0 0 0 0 0 $N2 [1] 0 0 0 0 0 0 0 0 0 0 $N3 [1] 0 0 0 0 0 0 0 0 0 0 $N4 [1] 0 0 0 0 0 0 0 0 0 0 $N5 [1] 0 0 0 0 0 0 0 0 0 0 $N6 [1] 0 0 0 0 0 0 0 0 0 0 $N7 [1] 0 0 0 0 0 0 0

[R] trouble with cloud output to bmp when in loop

2006-12-08 Thread Eric Peterson
I have some data that I need to view in various 3-D clouds. To better see the cloud structure on a 2-D screen I would like to output a bunch of bmp files with clouds at slightly different angles, then run them through an external program to animate them. But I'm having trouble getting cloud()

Re: [R] trouble with cloud output to bmp when in loop

2006-12-08 Thread Prof Brian Ripley
This is FAQ Q7.22 On Fri, 8 Dec 2006, Eric Peterson wrote: I have some data that I need to view in various 3-D clouds. To better see the cloud structure on a 2-D screen I would like to output a bunch of bmp files with clouds at slightly different angles, then run them through an external

Re: [R] any way to make the code more efficient ?

2006-12-08 Thread David Farrar
Something like this may be reasonably efficient. I create a length-500 list of 1400*4 matrices of uniform random numbers. Farrar numArrays - 500 # number of arrays arrDim1 - 1400 # array num. rows arrDim2 - 4 # array num. cols arrList - list(numArrays,

[R] Run Sample R (Linux)

2006-12-08 Thread Nuno Vale
Hi, all How do I run sample R (Linux). I open R, find a prompt an now what? Thanks Nuno Vale [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting

Re: [R] trouble with cloud output to bmp when in loop

2006-12-08 Thread Deepayan Sarkar
On 12/8/06, Eric Peterson [EMAIL PROTECTED] wrote: I have some data that I need to view in various 3-D clouds. To better see the cloud structure on a 2-D screen I would like to output a bunch of bmp files with clouds at slightly different angles, then run them through an external program to

[R] Problem of Running Simulations for Monte Carlo Spatial Segregation Test using Spatialkernel Package

2006-12-08 Thread Wei Zhang
Hello, When I used spseg function in the spatialkernel package to run Monte Carlo spatial segregation test, R would not let me run more than 50 simulations. That is, I tried to run the following code, sp - spseg(pts, bin, hcv, opt=3, ntest=1000, poly=polyb) where pts was a 116*2 matrix

[R] How to identify structural breaks in GARCH?

2006-12-08 Thread Rick Xu
hi all, I am trying to find some break points in GARCH model. Is there any function for it? any suggestion is appreciated! Thanks Rick Cheap talk? __

[R] Simulation with R

2006-12-08 Thread Ethan Johnsons
An apparatus exists whereby a collection of balls is displaced to the top of a stack by suction. A top level (Level 1) each ball is shifted 1 unit to the left or 1 unit to the right at random with equal probability. The ball then drops down to level 2. At Level 2, each ball is again shifted 1 unit