Re: [R] package ssfcov and non-visible functions; was: Help needed!

2011-04-26 Thread Uwe Ligges
On 25.04.2011 20:05, shuangyan wrote: Hello, i got this package from the paper: Nonparametric Covariance Function estimation for Functional and Longitudinal data. http://stat.wharton.upenn.edu/~tcai/paper/html/Covariance-Function.html. Thanks lot! 0. Please do read the posting guide!!! This

Re: [R] rJava Help

2011-04-26 Thread Prof Brian Ripley
On Tue, 26 Apr 2011, Wincent wrote: I believe this posting is placed, and I take the liberty to re-direct to the r-help mailing list. But this is *NOT* the support list for rJava: that is http://rosuda.org/lists.shtml In particular the author of rJava does not monitor R-help. Regards,

Re: [R] Factor function

2011-04-26 Thread Petr PIKAL
Hi d-data.frame(matrix(c(ww,ww,xx,yy,ww,yy,xx,yy,NA), ncol=3, byrow=TRUE)) Change character value NA to missing value NA d[d[,3]==NA,3]-NA If you want drop any unused levels of a factor just use factor(d[,3]) [1] xx yy NA Levels: xx yy Regards Petr r-help-boun...@r-project.org napsal

[R] what's wrong with plot(..., type=p)?

2011-04-26 Thread Ivan Calandra
Dear users, I'm trying to get a dot plot but always end up with a boxplot. Can someone please tell me what I am doing wrong? df - structure(list(FACETTE = structure(c(1L, 1L, 1L, 1L, 2L, 2L, + 2L, 2L), .Label = c(base, tip), class = factor), Sq = c(274836, + 0.74182, 0.709205, 0.984552,

Re: [R] what's wrong with plot(..., type=p)?

2011-04-26 Thread Bob O'Hara
On 26 April 2011 12:08, Ivan Calandra ivan.calan...@uni-hamburg.de wrote: Dear users, I'm trying to get a dot plot but always end up with a boxplot. Can someone please tell me what I am doing wrong? df - structure(list(FACETTE = structure(c(1L, 1L, 1L, 1L, 2L, 2L, + 2L, 2L), .Label =

Re: [R] what's wrong with plot(..., type=p)?

2011-04-26 Thread Peter Ehlers
On 2011-04-26 03:08, Ivan Calandra wrote: Dear users, I'm trying to get a dot plot but always end up with a boxplot. Can someone please tell me what I am doing wrong? df- structure(list(FACETTE = structure(c(1L, 1L, 1L, 1L, 2L, 2L, + 2L, 2L), .Label = c(base, tip), class = factor), Sq =

[R] Second largest element from each matrix row

2011-04-26 Thread Lars Bishop
Hi, I need to extract the second largest element from each row of a matrix. Below is my solution, but I think there should be a more efficient way to accomplish the same, or not? set.seed(1) a - matrix(rnorm(9), 3 ,3) sec.large - as.vector(apply(a, 1, order, decreasing=T)[2,]) ans -

Re: [R] Second largest element from each matrix row

2011-04-26 Thread Santosh Srinivas
would this work (shorter)? apply(a, 1, function(x) x[order(x)[2]]) On Tue, Apr 26, 2011 at 5:31 PM, Lars Bishop lars...@gmail.com wrote: Hi, I need to extract the second largest element from each row of a matrix. Below is my solution, but I think there should be a more efficient way to

Re: [R] Second largest element from each matrix row

2011-04-26 Thread Dimitris Rizopoulos
one way is the following: a - matrix(rnorm(9), 3 ,3) aa - a[order(row(a), -a)] matrix(aa, nrow(a), byrow = TRUE)[, 2] I hope it helps. Best, Dimitris On 4/26/2011 2:01 PM, Lars Bishop wrote: Hi, I need to extract the second largest element from each row of a matrix. Below is my solution,

Re: [R] Second largest element from each matrix row

2011-04-26 Thread Peter Ehlers
On 2011-04-26 05:01, Lars Bishop wrote: Hi, I need to extract the second largest element from each row of a matrix. Below is my solution, but I think there should be a more efficient way to accomplish the same, or not? set.seed(1) a- matrix(rnorm(9), 3 ,3) sec.large- as.vector(apply(a,

Re: [R] Second largest element from each matrix row

2011-04-26 Thread David Winsemius
On Apr 26, 2011, at 8:01 AM, Lars Bishop wrote: Hi, I need to extract the second largest element from each row of a matrix. Below is my solution, but I think there should be a more efficient way to accomplish the same, or not? set.seed(1) a - matrix(rnorm(9), 3 ,3) sec.large -

[R] Immutable ticks using ts.plot?

2011-04-26 Thread Phil Morefield
Hello all-   What I'm going for here is a stack of four time series plots that use a common X axis on the bottom plot. And setting up customized tick marks on each plot that help illustrate the respective trends. Here's my code:   Start fig_data - ts(read.csv(F:/mydata.csv),

Re: [R] what's wrong with plot(..., type=p)?

2011-04-26 Thread Ivan Calandra
Dear Bob, Thanks for your answer! I didn't think factors would be a problem for plot() Ivan Le 4/26/2011 12:21, Bob O'Hara a écrit : On 26 April 2011 12:08, Ivan Calandra ivan.calan...@uni-hamburg.de mailto:ivan.calan...@uni-hamburg.de wrote: Dear users, I'm trying to get a dot

[R] R plot : hat symbol and cex.lab

2011-04-26 Thread BMichel
Hello, Does anybody know how to make the hat correctly appears in the label of this plot (with this cex.lab coefficient) : plot(1:10, 1:10,ylab = expression(hat(h)),cex.lab = 1.5) The hat does not completely appear on my graph, it is like cut on the left side. It tried to change the margin :

[R] Running Fortran code from R

2011-04-26 Thread A.Noufaily
Dear R users, I have a Fortran code that I would like to compile and call from R later. I have never worked with Fortran before. Does anyone know the steps to create Fortran DLLs for R on a Windows PC. Is anyone aware of a manual (or does anyone know how to) that explains: - What tools

Re: [R] RStudio -manipulate command

2011-04-26 Thread veepsirtt
require(quantmod) getSymbols(GLD) library(manipulate) manipulate( plot(Cl(GLD), xlim=c(0,x.max)), x.max=slider(10,100)) Why the graph is not plotting? thanks veepsirtt -- View this message in context: http://r.789695.n4.nabble.com/RStudio-manipulate-command-tp3474947p3474976.html Sent

[R] RStudio -manipulate command

2011-04-26 Thread veepsirtt
Hello, How to plot the time series values of YHOO symbol?, getSymbols(YHOO,src=google) library(manipulate) manipulate( plot(YHOO, xlim=c(0,x.max)), x.max=slider(10,250)) while running this code I am getting this message Warning message: In plot.xts(YHOO, xlim = c(0, x.max)) : only the

[R] R plot : hat symbol and cex.lab

2011-04-26 Thread BMichel
Hello, Does anybody know how to make the hat correctly appears in the label of this plot (with this cex.lab coefficient) : plot(1:10, 1:10,ylab = expression(hat(h)),cex.lab = 1.5) The hat does not completely appear on my graph, it is like cut on the left side. It tried to change the margin :

[R] VIP extraction

2011-04-26 Thread tommym
Hi, Does anyone know how to extract the VIP (Variable influence on Projection) from a Partial Least Squares model? I'm using Package PLS. Thanks in Advance Tommy -- View this message in context: http://r.789695.n4.nabble.com/VIP-extraction-tp3475099p3475099.html Sent from the R help mailing

Re: [R] R plot : hat symbol and cex.lab

2011-04-26 Thread Richard M. Heiberger
plot(1:10, 1:10, ylab=) mtext(side=2, expression(hat(h)),cex = 1.5, line=2.5) Rich On Tue, Apr 26, 2011 at 7:45 AM, BMichel michel.bertrand@gmail.comwrote: Hello, Does anybody know how to make the hat correctly appears in the label of this plot (with this cex.lab coefficient) :

Re: [R] My code is too loopy

2011-04-26 Thread Dimitri Liakhovitski
Dennis, this is really great, thanks a lot! Do you know how to prevent the result from omitting the first 2 values. I mean - it starts (within each group) with the 3rd row but omits the first 2... Dimitri On Mon, Apr 25, 2011 at 5:31 PM, Dennis Murphy djmu...@gmail.com wrote: Hi: I think the

Re: [R] R plot : hat symbol and cex.lab

2011-04-26 Thread Duncan Murdoch
On 26/04/2011 8:01 AM, BMichel wrote: Hello, Does anybody know how to make the hat correctly appears in the label of this plot (with this cex.lab coefficient) : plot(1:10, 1:10,ylab = expression(hat(h)),cex.lab = 1.5) The hat does not completely appear on my graph, it is like cut on the left

Re: [R] Running Fortran code from R

2011-04-26 Thread Duncan Murdoch
On 26/04/2011 8:19 AM, A.Noufaily wrote: Dear R users, I have a Fortran code that I would like to compile and call from R later. I have never worked with Fortran before. Does anyone know the steps to create Fortran DLLs for R on a Windows PC. Is anyone aware of a manual (or does anyone know

Re: [R] Second largest element from each matrix row

2011-04-26 Thread Peter Ehlers
On 2011-04-26 05:26, Dimitris Rizopoulos wrote: one way is the following: a- matrix(rnorm(9), 3 ,3) aa- a[order(row(a), -a)] matrix(aa, nrow(a), byrow = TRUE)[, 2] That's clever, Dmitris. And very fast! Lars: my apologies; I didn't read your request carefully. You asked for more _efficient_

Re: [R] Second largest element from each matrix row

2011-04-26 Thread Lars Bishop
Thanks a lot to all of you! On Tue, Apr 26, 2011 at 10:34 AM, Peter Ehlers ehl...@ucalgary.ca wrote: On 2011-04-26 05:26, Dimitris Rizopoulos wrote: one way is the following: a- matrix(rnorm(9), 3 ,3) aa- a[order(row(a), -a)] matrix(aa, nrow(a), byrow = TRUE)[, 2] That's clever,

Re: [R] My code is too loopy

2011-04-26 Thread Dimitri Liakhovitski
I would probably still have to manually specify the values for row 1 and row 2 - and then loop through groups. Something like: mydata[!is.na(mydata$myvalue),new.value]-mydata[!is.na(mydata$myvalue),myvalue]*0.5 # this calculates the values for row 1 h - function(x) embed(x, 3) %*% c(0.5, 0.35,

Re: [R] Second largest element from each matrix row

2011-04-26 Thread peter dalgaard
On Apr 26, 2011, at 14:36 , David Winsemius wrote: On Apr 26, 2011, at 8:01 AM, Lars Bishop wrote: Hi, I need to extract the second largest element from each row of a matrix. Below is my solution, but I think there should be a more efficient way to accomplish the same, or not?

[R] Problem with lapply and splitted variables

2011-04-26 Thread ivan
Dear Community, I have the following two variables, which I have split according to a factor: *y1* [1] 1 2 3 [2] 2 3 4 and *y2* A B [1] 1 4 2 5 3 6 [2] 2 5 3 6 4 7 Now I need the following Vector Autoregressive Models: VAR(cbind(y1[1],y2[1]$A)), VAR(cbind(y1[1],y2[1]$B)),

Re: [R] graphics: 3D regression plane

2011-04-26 Thread agent dunham
Dear community, As it's explained I've tried the following: model- lm(log(v1)~log(v2)+v3, data=dat) newax- expand.grid( v2 = seq(min(log(dat$v2)), max(log(dat$v2)), length=100), v3= seq(min(dat$v3), max(dat$v3), length=100) ) fit - predict(model,newax) graph -

Re: [R] Factor function

2011-04-26 Thread Lisa
Thank you so much! Lisa -- View this message in context: http://r.789695.n4.nabble.com/Factor-function-tp3473984p3475549.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org mailing list

[R] splitting and reorganising a data.frame

2011-04-26 Thread Lutze
Hey, i have a question about how to reorganize a data frame in the easiest way. my example: what would be the easiest way to bring a data.frame such like this: nr height age Seed 1 1 4.51 3 301 2 15 10.89 5 301 3 29 28.72 10 301 4 43 41.74 15 301 5 57 52.70 20

Re: [R] Second largest element from each matrix row

2011-04-26 Thread William Dunlap
A different approach is to use order() to sort first by row number and then break the ties by value. It is quick when there are lots of short rows. f1 - function (x) +apply(x, 1, function(row) sort(row, decreasing = TRUE)[2]) f2 - function (x) + -apply(-x, 1, function(row)

Re: [R] Second largest element from each matrix row

2011-04-26 Thread William Dunlap
And I hit the send button before adding the timings for when there were lots of columns and few rows. f3 changes from the best to the worst in this case. There is rarely one most efficient function for all datasets. x - t(x) benchmark(r1 - f1(x), r2 - f2(x), r3 - f3(x), r4 - f4(x),

Re: [R] splitting and reorganising a data.frame

2011-04-26 Thread jim holtman
try this: x nr height age Seed 1 1 4.51 3 301 2 15 10.89 5 301 3 29 28.72 10 301 4 43 41.74 15 301 5 57 52.70 20 301 6 71 60.92 25 301 7 2 4.55 3 303 8 16 10.92 5 303 9 30 29.07 10 303 10 44 42.83 15 303 11 58 53.88 20 303 12 72 63.39 25

Re: [R] Second largest element from each matrix row

2011-04-26 Thread Peter Ehlers
On 2011-04-26 09:11, William Dunlap wrote: A different approach is to use order() to sort first by row number and then break the ties by value. It is quick when there are lots of short rows. Bill, That's what Dmitris did, too; his solution falls between f3 and f4. Unless speed were

Re: [R] graphics: 3D regression plane

2011-04-26 Thread Richard M. Heiberger
On Tue, Apr 26, 2011 at 11:18 AM, agent dunham crossp...@hotmail.comwrote: Dear community, As it's explained I've tried the following: model- lm(log(v1)~log(v2)+v3, data=dat) newax- expand.grid( v2 = seq(min(log(dat$v2)), max(log(dat$v2)), length=100), v3= seq(min(dat$v3),

Re: [R] Factor function

2011-04-26 Thread Petr Savicky
On Tue, Apr 26, 2011 at 10:51:33AM +0200, Petr PIKAL wrote: Hi d-data.frame(matrix(c(ww,ww,xx,yy,ww,yy,xx,yy,NA), ncol=3, byrow=TRUE)) Change character value NA to missing value NA d[d[,3]==NA,3]-NA If you want drop any unused levels of a factor just use factor(d[,3]) [1] xx

[R] Hook into Coercion Framework for data.frame

2011-04-26 Thread Von Der Hirschheydt, Juergen
Hi, I am looking into a way to hook into the R coercion framework to allow me to convert table-like data stored within a COM object into a data.frame. Some of our COM objects have their own table-like data storage, and from R's point of view it's an object (EXTPTRSXP) decoarated with a sepcial

[R] separate and arrange outputs

2011-04-26 Thread ivan
Hello, given that a self made function produces multiple outputs, is there a possibility to separate latter by stars or simply by blank lines? Are there funtions for the arrangement of the output in general? Thank you. Best Regards [[alternative HTML version deleted]]

Re: [R] Factor function

2011-04-26 Thread peter dalgaard
On Apr 26, 2011, at 18:52 , Petr Savicky wrote: On Tue, Apr 26, 2011 at 10:51:33AM +0200, Petr PIKAL wrote: Hi d-data.frame(matrix(c(ww,ww,xx,yy,ww,yy,xx,yy,NA), ncol=3, byrow=TRUE)) Change character value NA to missing value NA d[d[,3]==NA,3]-NA If you want drop any unused

Re: [R] How can I extract information from list which class is nls

2011-04-26 Thread Schatzi
How do I extract the standard error of the parameter estimates? Also, if I would like to add two parameters together (x+y), can I use this equation to calculate the new standard error?: x = parameter 1 y = parameter 2 xSE = SE parameter 1 ySE = SE parameter 2

[R] Tell the difference between characters

2011-04-26 Thread Lisa
Dear all, I just want to determine if the characters in a character string are the same or not. For example, temp - c(aa, aA, ab) How do I determine the first one have the two same “a”, and the second and third have the different characters? Thanks in advance. Lisa -- View this message in

Re: [R] Predicting with a principal component regression model: non-conformable arguments error

2011-04-26 Thread Alison Callahan
Hello again all, I am responding to my own earlier post about a non-conformable arguments error with the predict() function of the pls package ( http://cran.r-project.org/web/packages/pls/) in R 2.13.0 (running in Ubuntu 10.10). I believe I have narrowed down the cause of the error. My new

Re: [R] Tell the difference between characters

2011-04-26 Thread Jorge Ivan Velez
Hi Lisa, Is this what you have in mind? temp - c(aa, aA, ab) temp == temp[1] [1] TRUE FALSE FALSE HTH, Jorge On Tue, Apr 26, 2011 at 2:09 PM, Lisa wrote: Dear all, I just want to determine if the characters in a character string are the same or not. For example, temp - c(aa, aA,

Re: [R] Tell the difference between characters

2011-04-26 Thread Sarah Goslee
Hi Lisa, On Tue, Apr 26, 2011 at 2:09 PM, Lisa lisa...@gmail.com wrote: Dear all, I just want to determine if the characters in a character string are the same or not. For example, temp - c(aa, aA, ab) How do I determine the first one have the two same “a”, and the second and third have

Re: [R] Tell the difference between characters

2011-04-26 Thread jim holtman
This will handle varying length strings if you want to test for the same character: temp - c(aa, aA, ab) x - strsplit(temp, '') x [[1]] [1] a a [[2]] [1] a A [[3]] [1] a b sapply(x, function(z) all(z[1] == z)) [1] TRUE FALSE FALSE On Tue, Apr 26, 2011 at 2:09 PM, Lisa

Re: [R] Tell the difference between characters

2011-04-26 Thread Henrique Dallazuanna
Try this: sapply(apply(sapply(temp, charToRaw), 2, unique), length) == 1 On Tue, Apr 26, 2011 at 3:09 PM, Lisa lisa...@gmail.com wrote: Dear all, I just want to determine if the characters in a character string are the same or not. For example, temp - c(aa, aA, ab) How do I determine the

Re: [R] Using Java methods in R

2011-04-26 Thread hill0093
Thanks Icn for pointing that out, but I don't understand it. My use of .jcall to return a type double scalar or String worked. My use of .jfield to get a one dimensional static array worked. My use of .jfield to get a static scalar constant did not work. My use of .jfield to get a two dimensional

Re: [R] separate and arrange outputs

2011-04-26 Thread Jerome Asselin
On Tue, 2011-04-26 at 19:46 +0200, ivan wrote: Hello, given that a self made function produces multiple outputs, is there a possibility to separate latter by stars or simply by blank lines? Are there funtions for the arrangement of the output in general? You can create a class for your

Re: [R] Hook into Coercion Framework for data.frame

2011-04-26 Thread Erich Neuwirth
statconnDCOM, availagble from rcom.univie.ac.at is a (D)COM server accessing R. rcom (available from CRAN) is an R package which can turn R into a COM server or into a COM client. These tools have their own mailing list which can be subscribed at rcom.univie.ac.at. On 4/26/2011 6:20 PM, Von

[R] About snow packages

2011-04-26 Thread Truc Nguyen Trung
Dear Luke ! Thanh you for the lovely packages. I have used it, it woks fine for Linux, XP, but concerning about windows 7 - 64 bits. I have problem with function makeCluster(). with R 13.0 version. I wonder it may caused a update problem or ??? Do you have any hint ??? Best Truc

[R] Questions about 'heatmap.2' function

2011-04-26 Thread karena
I am trying a heatmap. I have 30 individuals and 1,000 genes. Some components I want for this heatmap plot: (1) the 'color-key'; (2) a banner across the top to emphasize how the hierarchical clustering has correctly split the data into the two groups; I use the 'heatmap.2' function in the

[R] Segmented Error Message

2011-04-26 Thread Alexander Sherman
Hi All, I am trying to use the segmented package to determine the break point in a simple quadratic regression. I am receiving the error (Some) estimated psi out of range I searched the message board and found others that have had the same issue, but no clear solutions have been

[R] plot() under Rserve

2011-04-26 Thread Jonathan Shore
Hi, Rserve allows one to render plots into jpeg with R code such as: jpeg(filename, ...) plot(...) dev.off() However, substituting png, tiff, or bmp device redirection fails on Rserve with eval error on OSX. png(filename, ...) plot(...) dev.off() The above in an eval

Re: [R] Tell the difference between characters

2011-04-26 Thread Lisa
Thanks a lot. Lisa -- View this message in context: http://r.789695.n4.nabble.com/Tell-the-difference-between-characters-tp3476130p3476352.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org mailing list

[R] Normality tests

2011-04-26 Thread Bruce Kindseth
I have a large amount of data which I break down into a collection of vectors of 100-125 values each. I would like to test the normality of the vectors and compare them. In the interactive mode I can test any one vector using the Shapiro-Wilk test or the Kolmogorov-Smirnov test. My problem is

Re: [R] Tell the difference between characters

2011-04-26 Thread Lisa
Yes. That is what I want. Thank you very much. Lisa -- View this message in context: http://r.789695.n4.nabble.com/Tell-the-difference-between-characters-tp3476130p3476288.html Sent from the R help mailing list archive at Nabble.com. __

Re: [R] Normality tests

2011-04-26 Thread Peter Ehlers
On 2011-04-26 13:15, Bruce Kindseth wrote: I have a large amount of data which I break down into a collection of vectors of 100-125 values each. I would like to test the normality of the vectors and compare them. In the interactive mode I can test any one vector using the Shapiro-Wilk test or

Re: [R] Normality tests

2011-04-26 Thread Jerome Asselin
On Tue, 2011-04-26 at 16:15 -0400, Bruce Kindseth wrote: I have a large amount of data which I break down into a collection of vectors of 100-125 values each. I would like to test the normality of the vectors and compare them. In the interactive mode I can test any one vector using the

Re: [R] Normality tests

2011-04-26 Thread Jorge Ivan Velez
Hi Bruce, One way is via apply() # some data set.seed(123) X - matrix(rnorm(100), ncol = 5) X # tests t(apply(X, 2, function(x){ sw - shapiro.test(x) c(sw$statistic, P = sw$p.value) })) See ?apply and ?str and ?shapiro.test for more information. HTH, Jorge

[R] Undestanding return()

2011-04-26 Thread Bogaso Christofer
Here, I have following generic function: Fn1 - function(x) { return(x) # assume x is calculated in previous steps . return(y) # assume y is calculated in previous steps ..

Re: [R] Undestanding return()

2011-04-26 Thread jim holtman
As soon as you execute the 'return' , the value is returned. What you did not show is did the code have if-then-else to go down separate paths. On Tue, Apr 26, 2011 at 5:29 PM, Bogaso Christofer bogaso.christo...@gmail.com wrote: Here, I have following generic function: Fn1 - function(x) {

Re: [R] Multi-dimensional non-linear fitting - advice on best method?

2011-04-26 Thread Julian Gilbey
On Mon, Apr 25, 2011 at 12:57:46AM +0200, peter dalgaard wrote: I have a set of data of the form (x, y1, y2) where x is the independent variable and (y1, y2) is the response pair. The model is some messy non-linear function: (y1, y2) = f(x; param1, param2, ..., paramk) + (y1error,

[R] matrix

2011-04-26 Thread Val
Hi all, Assume I have a matrix xv= [1 0 0 0 0 12, 0 1 0 0 0 10, *0 0 1 0 0 -9,* 0 0 0 1 0 20, * 0 0 0 0 1 -5]* if the last column of xv less than 0 then I want to set zero the entire row. The desired output looks like the following. In this case row 3 and row 5 are set

Re: [R] Multi-dimensional non-linear fitting - advice on best method?

2011-04-26 Thread Julian Gilbey
On Sun, Apr 24, 2011 at 07:02:48PM -0400, Ravi Varadhan wrote: Julian, You have not specified your problem fully. What is the nature of f? Is f a scalar function or is it a vector function (2-dim)? It's something like this (only a bit worse): given x, work out alpha from cos(alpha) =

Re: [R] matrix

2011-04-26 Thread Peter Langfelder
On Tue, Apr 26, 2011 at 2:28 PM, Val valkr...@gmail.com wrote: Hi all, Assume I have a matrix xv=  [1 0 0 0 0 12,      0 1 0 0 0 10,  *    0 0 1 0 0 -9,*      0 0 0 1 0 20,    *  0 0 0 0 1 -5]* if the last column of xv  less than  0 then I want to set zero the entire row. The desired

Re: [R] matrix

2011-04-26 Thread Henrique Dallazuanna
Try this: replace(m, m[,ncol(m)] 0, 0) On Tue, Apr 26, 2011 at 6:28 PM, Val valkr...@gmail.com wrote: Hi all, Assume I have a matrix xv=  [1 0 0 0 0 12,      0 1 0 0 0 10,  *    0 0 1 0 0 -9,*      0 0 0 1 0 20,    *  0 0 0 0 1 -5]* if the last column of xv  less than  0 then I want

[R] Least Squares Method

2011-04-26 Thread Vana
Hi everyone, I am running the 'gls' command (least squares method) for a number of data out of which many are zeros. I strongly believe that the output is wrong and I think that this is due to the large number of zero values included in my dataset. I would like to ask if there is a command that

Re: [R] Least Squares Method

2011-04-26 Thread Joshua Wiley
Hi Vana, I am not sure what package gls() is in off hand, but many model fitting functions have a subset argument. If not, supposing your data is in dat, and the variable with the zeros in it that are concerning you is X, then something like: newdat - dat[dat[, X] != 0, ] and now fit gls() on

Re: [R] How can I extract information from list which class is nls

2011-04-26 Thread Joshua Wiley
Hi, One way would be: summary(nls.object)[[coefficients]][, Std. Error] If you have a hankering to do it yourself rather than go through the summary formula, the code here will get you there: getAnywhere(summary.nls) If you are going to be doing it a lot, creating a little function might be

Re: [R] How can I extract information from list which class is nls

2011-04-26 Thread Peter Ehlers
On 2011-04-26 15:11, Joshua Wiley wrote: Hi, One way would be: summary(nls.object)[[coefficients]][, Std. Error] If you have a hankering to do it yourself rather than go through the summary formula, the code here will get you there: getAnywhere(summary.nls) If you are going to be doing it a

[R] calculate probability circles

2011-04-26 Thread cindy Guo
Hi, All, I want to have the 1%, 2%, 3%, ... contours for Dirichlet distribution. I need the exact contour circles (mathematically) instead of contour plots. Can anyone help me with this? Many thanks, Cindy [[alternative HTML version deleted]]

Re: [R] My code is too loopy

2011-04-26 Thread Dennis Murphy
Hi: One approach is to remove the top two observations from each group. Here's one way: ddply(mydata, .(group), function(d) tail(d, -2)) Now apply the previous procedure to this data subset. HTH, Dennis On Tue, Apr 26, 2011 at 7:18 AM, Dimitri Liakhovitski dimitri.liakhovit...@gmail.com

[R] Problems saving an Object called by get

2011-04-26 Thread Luis Felipe Parra
Hello. I am trying to save an object which I created using assign as following: assign(paste(NombreAlgoritmo,_Portafolio,sep=),PortafolioInicial) save(get(paste(Algoritmo,_Portafolio,sep=)),file=paste(camino,\\Libreria\\Portafolio\\Port_,NombreAlgoritmo,\\,NombreAlgoritmo,_Portafolio.Rdata,sep=))

[R] sub-matrix block size

2011-04-26 Thread Santosh
Dear Rxperts Below is a small vector of values of zeros and non-zeros... was wondering if there is an efficient way to get the block sizes of submatrices of a big matrix similar to the one shown below? diagonal elements can be zero too. Rows with only a diagonal element may be considered as a

Re: [R] Undestanding return()

2011-04-26 Thread Jeff Newmiller
Yes, if there are no control statements such as if that prevent that return function from being activated. --- Jeff Newmiller The . . Go Live... DCN:jdnew...@dcn.davis.ca.us Basics: ##.#. ##.#. Live Go... Live: OO#..

[R] density plot of simulated exponential distributed data

2011-04-26 Thread Juanjuan Chai
Hi all, I tried to plot the density curve using the data from simulation. I am sure that the data should be exponentially distributed, but the plot of density curve always starts from (0,0) which is not the case for exponential distribution. Is there any way around this, to keep the

[R] Barplot for degree distribution

2011-04-26 Thread kparamas
In barplot for degree distribution x-axis is not seen. See the example below g = barabasi.game(500, 0.4) dd1 = degree.distribution(g) plot(dd1, xlab=degree, ylab = frequency) whereas barplot doesnot have any x-axis barplot(dd1, xlab = degree, ylab = frequency) Please see the figures

[R] logistic regression: wls and unbalanced samples

2011-04-26 Thread Andre Guimaraes
Greetings from Rio de Janeiro, Brazil. I am looking for advice / references on binary logistic regression with weighted least squares (using lrm weights), on the following context: 1) unbalanced sample (n0=1, n1=700); 2) sampling weights used to rebalance the sample (w0=1, w1=14.29); e 3)

[R] Help

2011-04-26 Thread петрович
Hey Everyone! I´m a quite new R user .. I found a problem that I'd like to share with you and help me find a solution. I have a large txt. file which I opened with read.table command, and what I understood from many R manuals is that I have a kind of matrix readed with read.table, I've used

Re: [R] How can I extract information from list which class is nls

2011-04-26 Thread Joshua Wiley
I would generally use the coef() extractor function if it's available (and it is for nls()). ?nls has an example:  coef(summary(fm1DNase1)) I knew about coef() on model objects, but I did not know it had methods for their summaries. What wonderful information! Josh which is a matrix from

Re: [R] Help

2011-04-26 Thread jim holtman
Is this what you were looking for as output. You did not show what the output would look like: x var1 var2 X. varN 1 122 nnn1 …1 2 213 nnn2 …2 3 422 nnn4 …2 4 432… …3 5 441… …4 6 500… …4 7 550… …4 str(x) 'data.frame': 7 obs. of 4

Re: [R] How can I extract information from list which class is nls

2011-04-26 Thread Gabor Grothendieck
On Tue, Apr 26, 2011 at 2:21 PM, Schatzi adele_thomp...@cargill.com wrote: How do I extract the standard error of the parameter estimates? Also, if I would like to add two parameters together (x+y), can I use this equation to calculate the new standard error?: x = parameter 1 y = parameter 2

Re: [R] density plot of simulated exponential distributed data

2011-04-26 Thread Dennis Murphy
Hi: Try this (and note the use of vectorization rather than a loop): rate - 3 dta - -log(1 - runif(1000))/rate hist(dta, nclass = 30, probability = TRUE) x - c(0.001, seq(0, 3, by = 0.01)) lines(x, dexp(x, rate = 3)) This is the difference in timings between the vectorized and iterative methods

Re: [R] sub-matrix block size

2011-04-26 Thread Peter Alspach
Tena koe Santosh It is not clear to me precisely what your blocking rules are (e.g., where should matrix[4,4] go, is matrix[5:7,5:7] to be considered as a different block to matrix[8:10,8:10]). Also, what happens if there is an isolated 1 (e.g., in location matrix[9,6])? However, I imagine

Re: [R] Barplot for degree distribution

2011-04-26 Thread Dennis Murphy
Hi: Firstly, you should have mentioned that you were using the igraph package; with over 2700 R packages available on CRAN, it's unreasonable to expect folks to know to which package a particular function resides, but you may not have been aware of that fact. It turns out that dd1 is a numeric

Re: [R] Problems saving an Object called by get

2011-04-26 Thread David Winsemius
On Apr 26, 2011, at 7:37 PM, Luis Felipe Parra wrote: Hello. I am trying to save an object which I created using assign as following: assign(paste(NombreAlgoritmo,_Portafolio,sep=),PortafolioInicial) save(get(paste(Algoritmo,_Portafolio,sep=)),file=paste(camino,\

Re: [R] Problems saving an Object called by get

2011-04-26 Thread Luis Felipe Parra
Sorry David, I understand what you mean but could you help with how it would be done more specifically. Thanks On Wed, Apr 27, 2011 at 11:27 AM, David Winsemius dwinsem...@comcast.netwrote: On Apr 26, 2011, at 7:37 PM, Luis Felipe Parra wrote: Hello. I am trying to save an object which I

Re: [R] sub-matrix block size

2011-04-26 Thread Dennis Murphy
Hi: Maybe this can help get you started. Reading your data into a matrix m, m - structure(c(1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0,