Re: [R] Convert list to data frame while controlling column types

2009-08-22 Thread Alexander Shenkin
On 8/21/2009 3:04 PM, David Winsemius wrote: > > On Aug 21, 2009, at 3:41 PM, Alexander Shenkin wrote: > >> Thanks everyone for their replies, both on- and off-list. I should >> clarify, since I left out some important information. My original >> dataframe has some numeric columns, which get ch

Re: [R] help on vector auto-regressive model

2009-08-22 Thread Arun.stat
Goodness to fit can be checked on looking at the PACF and/or ACF of estimated residuals. Also you might want to see how valid the normality assumption is on them. Generally joint normality is assumed on the data, so that innovation are multivariate white noise process. Luna Moon wrote: > > Hi

Re: [R] Ridge regression [Repost]

2009-08-22 Thread Sabyasachi Patra
Thanks for the suggestion. But It will be more helpful if anybody comment on why I'm getting different outputs for three approaches. - Sabyasachi Patra PhD Scholar Indian institute of Technology Kanpur India. -- View this message in context: http://www.nabble.com/Ridge-regression--Repost--

Re: [R] ANCOVA with defined error terms

2009-08-22 Thread Richard M. Heiberger
Your model formula cannot be correct. The phrase Error(block/plot, data = track) is wrong. It has to be something like this Error(block/plot), data = track The Error function requires a well-defined formula. The "," character cannot be inside the Error function. You misunderstood my use of

Re: [R] integer and character conversion

2009-08-22 Thread Benilton Carvalho
it's 'scipen' you want to look at.. b On Aug 22, 2009, at 11:16 PM, David Winsemius wrote: On Aug 22, 2009, at 6:13 PM, Dajiang J. Liu wrote: Dear all,I want to convert a long integer to a string, and for example, 1 I used as.character(10) e.g, and it gives me back 1e+???. Wha

Re: [R] ANCOVA with defined error terms

2009-08-22 Thread hpdutra
I can actually run the code from my post. I used the nabble for my list server http://www.nabble.com/ANCOVA-with-defined-error-terms-td25055311.html#a25100032 I don't know which server you use, but that one is not truncated, I can copy the code just fine and run it. Anyway, here it is again summ

Re: [R] ANCOVA with defined error terms

2009-08-22 Thread Richard M. Heiberger
Your email program truncated the model. It would not run, hence was not reproducible. The last few characters of the first line are +Error(block/plot, which is syntactically impossible because there is no closing parenthesis before the comma. Try executing your email and see the difficulty.

[R] When factor is better than other types, such as vector and frame?

2009-08-22 Thread Peng Yu
Hi, It is easy to understand the types vector and frame. But I am wondering why the type factor is designed in R. What is the advantage of factor compare with other data types in R? Can somebody give an example in which case the type factor is much better than other data types? Regards, Peng __

[R] help on vector auto-regressive model

2009-08-22 Thread Luna Moon
Hi all, I am asking this for my friend. In VAR models, how do we test the goodness-of-fit of a VAR model? More specifically in R? Moreover, are there assumptions on the joint distribution of the data in the model? Thanks a lot! [[alternative HTML version deleted]] ___

Re: [R] integer and character conversion

2009-08-22 Thread David Winsemius
On Aug 22, 2009, at 6:13 PM, Dajiang J. Liu wrote: Dear all,I want to convert a long integer to a string, and for example, 1 I used as.character(10) e.g, and it gives me back 1e+???. What I want is a exact form, not exponential form. Any ideas how to do it? Thank The num

Re: [R] integer and character conversion

2009-08-22 Thread Henrique Dallazuanna
Try this: sprintf("%d", 10) On Sat, Aug 22, 2009 at 8:13 PM, Dajiang J. Liu wrote: > Dear all,I want to convert a long integer to a string, and for example, > 1 > I used as.character(10) e.g, and it gives me back 1e+???. What I > want is a exact form, not exponential form

[R] integer and character conversion

2009-08-22 Thread Dajiang J. Liu
Dear all,I want to convert a long integer to a string, and for example, 1 I used as.character(10) e.g, and it gives me back 1e+???. What I want is a exact form, not exponential form. Any ideas how to do it? Thank you very much. Regards, Dajiang [[alternative HTML version de

Re: [R] Why is R so slow at plotting on Ubuntu 9.04?

2009-08-22 Thread Thomas Harte
barry, thanks for the tip, which should really have been a "rtfm" now that i've read ?x11 ;-) in my own utilities package i've defined a function: `windows`<- function(width=7, height=7) x11("", width, height, type="nbcairo") for compatibility with the evil empire's eponymous function. using t

Re: [R] How to generate an error message when 'match' does not find any matches?

2009-08-22 Thread Henrique Dallazuanna
Try this: m <- match(4, c(1,2,3)) ifelse(is.na(m), stop("Not Found"), m) Or: stopifnot(!is.na(m)) On Sat, Aug 22, 2009 at 9:36 PM, Peng Yu wrote: > Hi, > > > match(4, c(1,2,3)) > [1] NA > > The above code run smoothly. It would not stop when 4 does not mach in > c(1,2,3). I am wondering if th

[R] How to generate an error message when 'match' does not find any matches?

2009-08-22 Thread Peng Yu
Hi, > match(4, c(1,2,3)) [1] NA The above code run smoothly. It would not stop when 4 does not mach in c(1,2,3). I am wondering if there is a way to stop the code and pop up an error message immediately. This capability to stop will make debugging easier. Regards, Peng _

[R] Latest information on how to debug R script

2009-08-22 Thread Peng Yu
Hi, http://cran.r-project.org/doc/Rnews/Rnews_2003-3.pdf There is information on how to debug R. But since it is fairly old, I am wondering what the currently best way for debugging R script. Regards, Peng __ R-help@r-project.org mailing list https://s

[R] Call perl from R

2009-08-22 Thread Peng Yu
Hi, I see the following package that can help me call perl from R. But the webpage is about 3 years old. I am wondering what the latest package that can help calling perl from R. http://www.omegahat.org/RSPerl/ Regards, Peng __ R-help@r-project.org ma

Re: [R] ANCOVA with defined error terms

2009-08-22 Thread hpdutra
Hi Richard, there are no empty cells. I transform everything into factor, except the co-variate coon. Here is the full analysis with dput of the data. I'm afraid I have not enough DF for the thre-way interaction using your model as well. 12 plots divided in 3 blocks, each plot assigned to 2 cros

Re: [R] hey

2009-08-22 Thread milton ruser
Try again. 0. read the posting guide. 1. giving a creative "subject title"; 2. sending a minimum reproducible code, example, etc. cheers milton On Sat, Aug 22, 2009 at 3:34 PM, Wang qiang wrote: > dear friends, > i am now working on a longitudinal data using R. all the analyses have been > do

Re: [R] hey

2009-08-22 Thread stephen sefick
I am sure somebody probably does, but without knowing what your exact problem is we would have a hard time sorting through a library of text files to decide what to give you. Please read the posting guide. Stephen Sefick On Sat, Aug 22, 2009 at 2:34 PM, Wang qiang wrote: > dear friends, > i am n

Re: [R] Help on comparing two matrices

2009-08-22 Thread Gabor Grothendieck
On Sat, Aug 22, 2009 at 2:45 PM, Michael Kogan wrote: > Hi, > > I need to compare two matrices with each other. If you can get one of them > out of the other one by resorting the rows and/or the columns, then both of > them are equal, otherwise they're not. A matrix could look like this: >    [,1]

Re: [R] Where to put source code?

2009-08-22 Thread Sarah Goslee
Or, even more simply: save your commands or functions in a file. You can load them from R using: source("path/to/mystuff.R") Sarah On Sat, Aug 22, 2009 at 6:22 PM, Ron Burns wrote: > Peter- > > I use emacs and ESS.  Google r ess emacs and check out the first few hits. > > I use a split screen wit

Re: [R] Where to put source code?

2009-08-22 Thread Ron Burns
Peter- I use emacs and ESS. Google r ess emacs and check out the first few hits. I use a split screen with the R file to edit on the left and get the R output on the right. Single line commands are executed with C-c C-n and selected regions are executed using C-c C-r as well as a bunch of oth

Re: [R] computation of matrices in list of list

2009-08-22 Thread Benilton Carvalho
result <- Reduce("+", unlist(z, recursive=FALSE)) b On Aug 22, 2009, at 2:03 PM, kathie wrote: Dear Gabor Grothendieck, thank you for your comments. Ive already tried that. but I've got this error message. Reduce("+",z) Error in f(init, x[[i]]) : non-numeric argument to binary operato

Re: [R] Help on comparing two matrices

2009-08-22 Thread Ted Harding
Steve, I don't know for sure whether this will help to solve your problem, but you may be interested to read about the algorithm devised by David Kendall for sorting 0-1 matrices, as described in Incidence matrices, interval graphs and seriation in archeology. Pacific J. Math. Volume 28, Num

Re: [R] plotting the graph of density with an unknown distribution

2009-08-22 Thread Stephan Kolassa
Hi, Try kernel smoothing via the density() function. And take a look at ecdf(). HTH, Stephan sendona essile schrieb: How can I plot the graph of a density of a sample with an unknown distribution? I can provide any sample size which is required. I want to have a smooth density graph of my d

[R] plotting the graph of density with an unknown distribution

2009-08-22 Thread sendona essile
How can I plot the graph of a density of a sample with an unknown distribution? I can provide any sample size which is required. I want to have a smooth density graph of my data. New Email addresses available on Yahoo! Get the Email name you've always wanted on the new @ymail and @rocketm

[R] Better weight management / weight loss through science

2009-08-22 Thread Ajay Shah
Folks, I wrote some text and code to help people think more clearly about weight loss or weight management. This is at: http://www.mayin.org/ajayshah/MISC/weightloss.html I hope this is useful to others. Do tell me if there are things there which I can improve. -- Ajay Shah

[R] hey

2009-08-22 Thread Wang qiang
dear friends, i am now working on a longitudinal data using R. all the analyses have been done. now I am wondering how the plot out the cross-level interaction using R. do you guys have some syntax?? thank you so much!! Best, -- Qiang Wang, MS Graduate student Industrial-Organizational Psychology

Re: [R] intra-class correlation? coherence among multiple ordinal responses

2009-08-22 Thread Daniel Malter
Thank you, William. Best, Daniel William Revelle wrote: > > At 6:15 PM -0400 8/21/09, Daniel Malter wrote: >>I have a quick statistical question and hoped somebody has a tip for me >>without me having to go to the local statistician on Monday. >> >>I assess 4 statements from 90 subjects. Each

Re: [R] Help on comparing two matrices

2009-08-22 Thread David Winsemius
On Aug 22, 2009, at 3:47 PM, David Winsemius wrote: On Aug 22, 2009, at 3:36 PM, Steve Lianoglou wrote: Hi, On Sat, Aug 22, 2009 at 2:45 PM, Michael Kogan wrote: Hi, I need to compare two matrices with each other. If you can get one of them out of the other one by resorting the rows

Re: [R] Help on comparing two matrices

2009-08-22 Thread David Winsemius
On Aug 22, 2009, at 3:36 PM, Steve Lianoglou wrote: Hi, On Sat, Aug 22, 2009 at 2:45 PM, Michael Kogan wrote: Hi, I need to compare two matrices with each other. If you can get one of them out of the other one by resorting the rows and/or the columns, then both of them are equal, ot

Re: [R] ANCOVA with defined error terms

2009-08-22 Thread Richard M. Heiberger
The three-way interactions you mention are included in the model formula I suggested. If they didn't appear in the expansion, it suggests that you have some aliasing due to empty cells. I can't do any more without your dataset. You can post your dataset with random response values. The exact dat

Re: [R] Help on comparing two matrices

2009-08-22 Thread Steve Lianoglou
On Sat, Aug 22, 2009 at 2:45 PM, Michael Kogan wrote: >> >> 1. Sort the rows after the row sums (greater sums first). >> 2. Sort the columns after the first column (columns with ones in the first >> row go left, columns with zeros go right). >> 3. Save the left part (all columns with ones in the

Re: [R] Help on comparing two matrices

2009-08-22 Thread Steve Lianoglou
Hi, On Sat, Aug 22, 2009 at 2:45 PM, Michael Kogan wrote: > Hi, > > I need to compare two matrices with each other. If you can get one of them > out of the other one by resorting the rows and/or the columns, then both of > them are equal, otherwise they're not. A matrix could look like this: > >

[R] Help on comparing two matrices

2009-08-22 Thread Michael Kogan
Hi, I need to compare two matrices with each other. If you can get one of them out of the other one by resorting the rows and/or the columns, then both of them are equal, otherwise they're not. A matrix could look like this: [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [1,]011

Re: [R] using loglog link in VGAM or creating loglog link for GLM

2009-08-22 Thread Mark Difford
Hi Kendra, >> I am trying to figure out how to apply a loglog link to a binomial >> model (dichotomous response variable with far more zeros than ones). If I were you I would look at ?zeroinfl in package pscl. Regards, Mark. Kendra Walker wrote: > > > > I am trying to figure out how to a

Re: [R] Trying something for fun...

2009-08-22 Thread Noah Silverman
And, of course that leads me to another question... With svm {e1071} I can ask the predict function to give me probabilities with lrm {Desigh} I can ask the predict function to give me probabilities I can't see how to do this with clogit. Would someone be kind enough to explain the output optio

Re: [R] Trying something for fun...

2009-08-22 Thread Noah Silverman
Thanks Charles, I'll have a look at the conditinoal logit function One question: My strata is the "race" (Actually concatonation of date and number) So the actual "values" used in the training set are different than the test set. Will that matter? (In other words, when training a clogit i

Re: [R] Trying something for fun...

2009-08-22 Thread Charles C. Berry
On Fri, 21 Aug 2009, Noah Silverman wrote: Hi, For fun, I'm trying to throw some horse racing data into either an svm or lrm model. Curious to see what comes out as there are so many published papers on this. One thing I don't know how to do is to standardize the probabilities by race.

[R] forest (meta) editing text

2009-08-22 Thread Polwart Calum (County Durham and Darlington NHS Foundation Trust)
OK - I've been doing some work on getting a forest plot or two together for a sub-group analaysis. Thats the crucial thing - because its a sub-group analysis rather than a meta-analsysis and all the forest (meta) and forestplot (rmeta) instructions assume you are doing a meta-analysis. I found

Re: [R] computation of matrices in list of list

2009-08-22 Thread David Winsemius
On Aug 22, 2009, at 1:03 PM, kathie wrote: Dear Gabor Grothendieck, thank you for your comments. Ive already tried that. but I've got this error message. Reduce("+",z) Error in f(init, x[[i]]) : non-numeric argument to binary operator > Reduce("+", c( LL[[1]], LL[[2]] ) ) [,1] [

Re: [R] computation of matrices in list of list

2009-08-22 Thread Steve Lianoglou
Hi Kathie, On Sat, Aug 22, 2009 at 1:03 PM, kathie wrote: Dear Gabor Grothendieck, > > > thank you for your comments. > > Ive already tried that. but I've got this error message. > > > > Reduce("+",z) > Error in f(init, x[[i]]) : non-numeric argument to binary operator > > > anyway, thanks > >

Re: [R] computation of matrices in list of list

2009-08-22 Thread kathie
Dear Gabor Grothendieck, thank you for your comments. Ive already tried that. but I've got this error message. > Reduce("+",z) Error in f(init, x[[i]]) : non-numeric argument to binary operator anyway, thanks ps. > is.matrix(z[[1]][[1]]) [1] TRUE I guess the reason "Reduce" doesn't wor

Re: [R] Why is R so slow at plotting on Ubuntu 9.04?

2009-08-22 Thread Barry Rowlingson
On Sat, Aug 22, 2009 at 5:52 PM, Thomas Harte wrote: > under Ubuntu 9.04 R seems to be very slow at plotting. > > the example below illustrates with a plot of error bars of sample means > where i watch as each error bar is plotted one at a time. very annoying and > pain in the neck when running Sw

[R] Why is R so slow at plotting on Ubuntu 9.04?

2009-08-22 Thread Thomas Harte
under Ubuntu 9.04 R seems to be very slow at plotting. the example below illustrates with a plot of error bars of sample means where i watch as each error bar is plotted one at a time. very annoying and pain in the neck when running Sweave repeatedly. running R 2.9.1 under Windoze on the same m

Re: [R] 2d color coded line plot

2009-08-22 Thread Gonçalo Graça
Your tips heave been very helpful. I tried Plotrix package and it seems to handle the job. Thank you all for your help! Gonçalo baptiste auguie wrote: geom_path in ggplot2 is another option, see two examples on this page: http://had.co.nz/ggplot2/geom_path.html HTH, baptiste 2009/8/21 J

Re: [R] computation of matrices in list of list

2009-08-22 Thread Gabor Grothendieck
See this: https://stat.ethz.ch/pipermail/r-help/2009-August/208002.html On Sat, Aug 22, 2009 at 11:41 AM, kathie wrote: > > Dear R users, > > I have the list as follows; > > #-- > >> z > > [[1]] > [[1]][[1]] > > matrix(A) > > [[1]][[2]] > > matr

[R] computation of matrices in list of list

2009-08-22 Thread kathie
Dear R users, I have the list as follows; #-- > z [[1]] [[1]][[1]] matrix(A) [[1]][[2]] matrix(B) [[1]][[3]] matrix(C) [[2]] [[2]][[1]] matrix(D) [[2]][[2]] matrix(E) [[2]][[3]] matrix(F) #-

Re: [R] ANCOVA with defined error terms

2009-08-22 Thread hpdutra
Thank you Richard, this works. But, the model you suggested me lacks some between subjects interactions, namely: veget:time:block fruit:time:block. According to Sokal and Rohlf I need to report those as well. Also, any ideas why the sum of squares on my model are different from yours summar

Re: [R] intra-class correlation? coherence among multiple ordinal responses

2009-08-22 Thread William Revelle
At 6:15 PM -0400 8/21/09, Daniel Malter wrote: I have a quick statistical question and hoped somebody has a tip for me without me having to go to the local statistician on Monday. I assess 4 statements from 90 subjects. Each of the 4 statements receives one of three responses (say -1, 0, or 1).

Re: [R] aggregating using a non-summary function?

2009-08-22 Thread Gabor Grothendieck
On Wed, Aug 19, 2009 at 12:14 AM, Gabor Grothendieck wrote: > On Tue, Aug 18, 2009 at 7:09 PM, Sherri Heck wrote: >> Dear all- >> >> I have a data set that looks as follows (data are taken every 5 minutes): >> >>      LST   in     mph    Deg   DegF  DegF2    %    volts   Deg    mph2   w/m2 >> 09050

Re: [R] kernel density estimates

2009-08-22 Thread David Winsemius
On Aug 22, 2009, at 9:44 AM, maram salem wrote: Dear All, I have a variable q which is a vector of 1000 simulated positive values; that is I generated 1000 samples from the pareto distribution, from each sample I calculated the value of q ( a certain fn in the sample observations), and th

Re: [R] Strange package installation error

2009-08-22 Thread Janet Rosenbaum
Thank you very much for the suggestion: you were spot on with the problem. As you and the package developer suggested, I upgraded R (I was running 2.6.*) to 2.9.* and the package installed with no problem. I hadn't known that could be a problem. Incidentally, is there any way to get R

Re: [R] "Special" LS estimation problem

2009-08-22 Thread megh
I found no fruitful suggestions as yet, therefore I have devised a simple mechanism for that. Here I can modify my model as : Y = X*a + error, X = (X1, X2), a = t(a1, a2) Now I can apply the standard LS procedure, to estimate a. Here is my code : Y <- replicate(10, matrix(rnorm(2),2), simplify

Re: [R] Quick explanation of model output

2009-08-22 Thread David Winsemius
On Aug 21, 2009, at 9:46 PM, Noah Silverman wrote: Hi, Been running the lrm model from the Design package. (Thanks Frank!) There are some output columns that I don't quite understand. What is "Wald Z" and then "P" which is 0 for all rows??? Wald Z would be the square root of Wald chi-squar

[R] kernel density estimates

2009-08-22 Thread maram salem
Dear All, I have a variable q which is a vector of 1000 simulated positive values; that is I generated 1000 samples from the pareto distribution, from each sample I calculated the value of q ( a certain fn in the sample observations), and thus I was left with 1000 values of q and I don't know th

Re: [R] help with median for each row

2009-08-22 Thread Jim Lemon
Jim Lemon wrote: Edward Chen wrote: Hi, I tried looking through google search on whether there's a way to computer the median for each row of a nxn matrix and return the medians for each row for further computation. And also if the number of columns in the matrix are even, how could I specif

Re: [R] help with median for each row

2009-08-22 Thread Jim Lemon
Edward Chen wrote: Hi, I tried looking through google search on whether there's a way to computer the median for each row of a nxn matrix and return the medians for each row for further computation. And also if the number of columns in the matrix are even, how could I specify which median to

Re: [R] creating gantt chart

2009-08-22 Thread Jim Lemon
rajclinasia wrote: Hi every one, I have a R dataset like this. labels starts ends first task 2004-01-01 2004-03-03 second task 2004-02-02 2004-05-05 third task 2004-03-03 2004-06-06 fourth task 2004-04-04 2004-08-08 fifth task 2004-05-05 2

Re: [R] Problem with passing a string to subset

2009-08-22 Thread baptiste auguie
That's right, however the bquote construct may be useful when combining several conditions, subset(foo, eval(bquote(.(mycond) & a < 5)) ) baptiste 2009/8/22 Vitalie S. : > On Fri, 21 Aug 2009 22:38:09 +0200, baptiste auguie > wrote: > >> Try this, >> >> mystr <-"c==1" >> subset(foo, eval(parse(

Re: [R] Problem with passing a string to subset

2009-08-22 Thread Vitalie S.
On Fri, 21 Aug 2009 22:38:09 +0200, baptiste auguie wrote: Try this, mystr <-"c==1" subset(foo, eval(parse(text = mystr)) ) library(fortunes) fortune("parse") # try several times # I prefer this, but there is probably a better way mycond<- quote(c==1) subset(foo, eval(bquote(.(mycond))) )

Re: [R] Lattice: How to do error bars

2009-08-22 Thread Deepayan Sarkar
On 8/11/09, Alex van der Spek wrote: > I am trying to add 2 stdev error bars to lattice type plots: > > panel.ebar<-function(x,y,dy=NULL,...) { > panel.xyplot(x,y,...) > panel.segments(x,y-dy,x,y+dy,...) > } > > Then: > > xyplot(y~x|fc,data=dat,dy=dat$dy,panel=panel.ebar) > >

Re: [R] adding points to a wireframe

2009-08-22 Thread Deepayan Sarkar
On 8/18/09, Jarrett Byrnes wrote: > A quick question. I'm trying to plot a surface from a fitted model along > with the original points, as in the following example: > > > df<-data.frame(expand.grid(100*runif(1:100), > 100*runif(1:100))) > df$Var3<-rnorm(length(df$Var1), mean=df$Var1*df$Var2, >

[R] Mann Kendall test for time series data

2009-08-22 Thread Bin1aya
Dear All, I do not know how to perform Mann kendall test with climate data. Using Rclimdex i have got trends of temperature and precipitation. Now I would like to know how significant is trend at 95% level of significance. So please suggest me. Thank you. Sincerely, Binaya Pasakhala -- View thi

[R] using loglog link in VGAM or creating loglog link for GLM

2009-08-22 Thread Kendra Walker
I am trying to figure out how to apply a loglog link to a binomial model (dichotomous response variable with far more zeros than ones). I am aware that there are several relevant posts on this list, but I am afraid I need a little more help. The two suggested approaches seem to be: 1)

Re: [R] Selecting groups with R

2009-08-22 Thread Peter Dalgaard
David Winsemius wrote: How can I eliminate the BLUE category completely so I can do a t-test using Color (with just the RED and WHITE subjects)? dataset$Color <- as.character(dataset$Color) or factor(dataset$Color), even. As has been pointed out already, t.test.formula et al. do this in

Re: [R] ggplot: colours to geom_segments

2009-08-22 Thread Robert Baer
Do you want something like: p <- ggplot(xx, aes(x = 0, xend = Expense, y = Food, yend = Food)) pa <- p + geom_point(aes(Expense, Food)) + geom_segment(colour=c("red","blue","purple","darkgreen")) + xlab("Food") + geom_vline(xintercept=40, colour='red') pa - Original Message ---

Re: [R] applying summary() to an object created with ols()

2009-08-22 Thread Mark Difford
Hi Benjamin, >> Does anyone know how I can set the *datadist()* and the *options()* such >> that I will get access to all coefficients? ## Do this before you fit your models, i.e. tell datadist &c what data set you are using. d <- datadist( subset(aa, Jahr>=1957 & Jahr<=1966) ) options( datadis