Re: [R] xts off by one confusion or error

2010-04-08 Thread Tim Coote
I find the following even more confusing as I thought that xts was a subclass of zoo and I'd expected that the conversion would have been more transparent > aggregate (vv, as.yearmon(index(vv)), mean) Feb 2010 6.08 > xts (aggregate (vv, as.yearmon(index(vv)), mean)) x Jan 2010 6.0

Re: [R] How to use tapply for quantile

2010-04-08 Thread Patrick Hausmann
Hi James, I don't know how to solve it with "tapply" (something with split I think..), but you could use "plyr" (from Hadley Wickham). library(plyr) # Generate some data set.seed(321) myD <- data.frame( Place = sample(c("AWQ","DFR", "WEQ"), 10, replace=T), Light = sample(LETTERS[1:2], 15,

[R] How to get the penalty matrix for natural cubic spline?

2010-04-08 Thread Yan Li
Hi, all I am trying to get the basis matrix and penalty matrix for natural cubic splines. In the "splines" package of R,"ns" can generate the B-spline basis matrix for a natural cubic spline. How can I get the basis matrix and penalty matrix for natural cubic spline. Thanks a lot! Lee [

Re: [R] general linear hypothesis testing for manova model

2010-04-08 Thread Peter Dalgaard
John Fox wrote: > Dear Philippe, > > The linear.hypothesis() function in the car package should do what you want. > > I hope this helps, > John Also, at least in many cases, anova.mlm in the base package. The catch is that the "L" of the LBM==0 has to correspond to a linear model reduction. T

[R] SSH Through R Script

2010-04-08 Thread afoo
Hi, I am trying to SSH to a remote server through R script. In other words, I would like to know how I can get a SSH connection to the remote server and then execute commands on that server with the R script. So in bash, I would normally type ssh -lusername remoteserver.com; press enter and then

Re: [R] how does one print code

2010-04-08 Thread David.Epstein
I downloaded the code, as Duncan Murdoch suggested. I also used sink() as suggested by others and found that the two methods gave identical results. I then fixed the bug in a private file and tried it out on a number of examples. It now seems to work fine, as far as I can tell. >From CRAN, I foun

Re: [R] Problem with Loops

2010-04-08 Thread mtesche
I removed the ceiling and it works! Thanks a heap, that was driving me crazy! -- View this message in context: http://n4.nabble.com/Problem-with-Loops-tp1794288p1801623.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project

Re: [R] lattice background grid

2010-04-08 Thread Wen Huang
Thanks a lot! On Apr 8, 2010, at 10:50 PM, Felix Andrews wrote: The default settings come from trellis.par.get("reference.line") On 9 April 2010 13:07, Wen Huang wrote: Hi, I wonder if anyone knows how to control color and darkness of the background grid generated by ' type = c("g", "p

Re: [R] lattice background grid

2010-04-08 Thread Wen Huang
It works perfectly! Thanks! On Apr 8, 2010, at 10:32 PM, David Winsemius wrote: On Apr 8, 2010, at 11:07 PM, Wen Huang wrote: Hi, I wonder if anyone knows how to control color and darkness of the background grid generated by ' type = c("g", "p") ' in a lattice plot (e.g., in xyplot). Th

Re: [R] lattice background grid

2010-04-08 Thread Felix Andrews
The default settings come from trellis.par.get("reference.line") On 9 April 2010 13:07, Wen Huang wrote: > Hi, > > I wonder if anyone knows how to control color and darkness of the background > grid generated by ' type = c("g", "p") ' in a lattice plot (e.g., in > xyplot). The documentation doe

Re: [R] lattice background grid

2010-04-08 Thread David Winsemius
On Apr 8, 2010, at 11:07 PM, Wen Huang wrote: Hi, I wonder if anyone knows how to control color and darkness of the background grid generated by ' type = c("g", "p") ' in a lattice plot (e.g., in xyplot). The documentation does not seem to offer a way to change them. I wonder. Here'

Re: [R] Problem with Loops

2010-04-08 Thread Erik Iverson
# obtain power power <- array(numeric(nr*np), dim=c(nr,np)) for (i in 1:np){ for (j in 1:nr){ result <- pwr.t.test(n = r[j], d = p[i], sig.level = .05, power = NULL, alternative = "two.sided") power[j,i] <- ceiling(result$power) } } First problem. Why are you calling ceil

Re: [R] Problem with Loops

2010-04-08 Thread Erik Iverson
Hello, mtesche wrote: Hello, I am trying to write a script with the end goal of graphing power (y) as a result of sample size (x) at a variety of effects sizes. I am new to loops, and I think my problem is there. Here's the script, which is modified from the script found at the bootom of http

[R] how to put two mosaic plots together

2010-04-08 Thread Wincent
library(vcd) data("Titanic") mosaic(Titanic) mosaic(~ Sex + Age + Survived, data = Titanic,main = "Survival on the Titanic", shade = TRUE, legend = TRUE) ## mosaic one data("HairEyeColor") mosaic(HairEyeColor, shade = TRUE, expected = list(c(1,2), 3)) ## mosaic tow I would like to put the two mo

[R] Problem with Loops

2010-04-08 Thread mtesche
Hello, I am trying to write a script with the end goal of graphing power (y) as a result of sample size (x) at a variety of effects sizes. I am new to loops, and I think my problem is there. Here's the script, which is modified from the script found at the bootom of http://www.statmethods.net/s

[R] lattice background grid

2010-04-08 Thread Wen Huang
Hi, I wonder if anyone knows how to control color and darkness of the background grid generated by ' type = c("g", "p") ' in a lattice plot (e.g., in xyplot). The documentation does not seem to offer a way to change them. Thanks a lot! Wen __

Re: [R] 3-D response surface using wireframe()

2010-04-08 Thread Felix Andrews
On 9 April 2010 11:18, David Winsemius wrote: > On Apr 8, 2010, at 8:29 PM, array chip wrote: > >> David, >> >> Thansk again! Sarkar's Lattice book is excellent source for lattice. Here >> is a link for all the figures and codes used in the book. You example is >> figure 13.7. >> >> http://lmdvr.r

[R] How to use tapply for quantile

2010-04-08 Thread James Rome
I am trying to calculate quantiles of a data frame column split up by two factors: # Calculate the quantiles quarts = tapply(gdf$tt, list(gdf$Runway, gdf$OnHour), FUN=quantile, na.rm = TRUE) This does not work: > quarts 04L 04R 15R 22L 22R 2732 33L

Re: [R] 3-D response surface using wireframe()

2010-04-08 Thread David Winsemius
On Apr 8, 2010, at 8:29 PM, array chip wrote: David, Thansk again! Sarkar's Lattice book is excellent source for lattice. Here is a link for all the figures and codes used in the book. You example is figure 13.7. http://lmdvr.r-forge.r-project.org/figures/figures.html I got the first po

Re: [R] Overfitting/Calibration plots (Statistics question)

2010-04-08 Thread Mark Seeto
Thank you very much for your help, Prof. Harrell. I was making the bad mistake of judging the appearance of the calibration plots without actually calculating the regression line. I was misjudging slopes of 0.8 or 0.9 as being slopes greater than 1. Kind regards, Mark Seeto > Mark, > > Try > > s

Re: [R] 3-D response surface using wireframe()

2010-04-08 Thread array chip
David, Thansk again! Sarkar's Lattice book is excellent source for lattice. Here is a link for all the figures and codes used in the book. You example is figure 13.7. http://lmdvr.r-forge.r-project.org/figures/figures.html I got the first point! For the second point below, Figure 13.7 an excell

Re: [R] Overfitting/Calibration plots (Statistics question)

2010-04-08 Thread Frank E Harrell Jr
Mark Seeto wrote: This isn't a question about R, but I'm hoping someone will be willing to help. I've been looking at calibration plots in multiple regression (plotting observed response Y on the vertical axis versus predicted response [Y hat] on the horizontal axis). According to Frank Harrell'

Re: [R] Placing the ≥ symbol in the Trellis custom strip

2010-04-08 Thread Felix Andrews
See ?plotmath for how to add mathematical symbols and markup to plots. e.g. xyplot(1:10 ~ 1:10 | factor(1:2), strip = strip.custom(factor.levels = expression("< 90 kg", "" >= 90 * " kg"))) On 9 April 2010 06:45, mahesh samtani wrote: > Hello, > I am trying to use ≥ symbol in the Trellis

Re: [R] Reading dates in R using SQL and otherwise (and someinteresting behavior by the data editor)

2010-04-08 Thread Paul Miller
Hi Paul, Jim, Dennis, and others,   I got RODBC and SQL Server to create a date variable in R (see below). I'm pretty sure the commands I was issuing before were working but that I was stripping off the date class every time I submitted the command "fix(mydata)." So I kept getting the mistaken i

Re: [R] formatting a result table (number of digits)

2010-04-08 Thread David Winsemius
On Apr 8, 2010, at 6:20 PM, Esmail wrote: Hello, Is there an easy way to format the output of a result table that R generates from a regression? I like the table, but would like to limit the number of decimal points in the entries if possible. For instance I would like only 3 digits of preci

[R] Overfitting/Calibration plots (Statistics question)

2010-04-08 Thread Mark Seeto
This isn't a question about R, but I'm hoping someone will be willing to help. I've been looking at calibration plots in multiple regression (plotting observed response Y on the vertical axis versus predicted response [Y hat] on the horizontal axis). According to Frank Harrell's "Regression Modeli

[R] formatting a result table (number of digits)

2010-04-08 Thread Esmail
Hello, Is there an easy way to format the output of a result table that R generates from a regression? I like the table, but would like to limit the number of decimal points in the entries if possible. For instance I would like only 3 digits of precision for the Value, Std.Error. (And if it wou

[R] biOps package installation

2010-04-08 Thread Konrad Banachewicz
Dear All, I found this nice example of PCA application on the web http://www.r-bloggers.com/principal-components-and-image-reconstruction/ and wanted to reproduce the results for myself. I installed biOps the usual way and got the message *package 'biOps' successfully unpacked and MD5 sums chec

Re: [R] C-index and Cox model

2010-04-08 Thread Frank E Harrell Jr
Bessy wrote: Dear all R users, I am building a Cox PH model on a small dataset. I am wondering how to measure the predictive power of my cox model? Normally the ROC curve or Gini value are used in logistic regression model. Is there any similar measurement suitable for Cox model? Also if I use

Re: [R] RandomForest how to identify two classes when only one is present

2010-04-08 Thread Steve Lianoglou
Hi, On Thu, Apr 8, 2010 at 1:18 PM, JMark wrote: > > I'm trying to do: > randomForest(f, data = moths.train) > > But I get this error: > Error in randomForest.default(m, y, ...) : >  Need at least two classes to do classification. > > When I look at the data for this, I realize there are no posit

Re: [R] how does one print code

2010-04-08 Thread Duncan Murdoch
On 08/04/2010 5:16 PM, David.Epstein wrote: There is quite a long piece of code defining a certain function in one of the R packages. I think the code has a bug and I want to get the code into a file so that I can take a proper look, and possibly fix it. how does one do this? (I mean getting the

Re: [R] Reading dates in R using SQL and otherwise (and someinteresting behavior by the data editor)

2010-04-08 Thread Paul Gilbert
I can use as.Date() on the result from an sql date field, but this may depend on the backend database engine too. There may also be some sensitivity to character set encoding used on the database and the client, and from you email it looks a bit like you could have some problems in this respect.

Re: [R] Code is too slow: mean-centering variables in a data framebysubgroup

2010-04-08 Thread Charles C. Berry
On Thu, 8 Apr 2010, Dimitri Liakhovitski wrote: Dear everyone, I was not sure if I should start a new topic - but the task is the same, so I am staying within the original one. Originally, I stated that my data frame has a lot of NAs. Now I am discovering - it's having a lot of zeros (rather tha

Re: [R] how does one print code

2010-04-08 Thread Ista Zahn
Hi David, You can use sink, like this: sink(file="lm.R") ## redirects output to the file lm.R print(lm) #prints the lm function sink() #r redirects output back to the console. Or just download the source... -Ista On Thu, Apr 8, 2010 at 10:16 PM, David.Epstein wrote: > > There is quite a long pi

Re: [R] how does one print code

2010-04-08 Thread Phil Spector
David - You can do what you want pretty easily using sink. Suppose you want the source code for function "blah" in the file "blah.func": sink('blah.func') print(blah) sink() - Phil Spector Statistical Computing F

[R] how does one print code

2010-04-08 Thread David.Epstein
There is quite a long piece of code defining a certain function in one of the R packages. I think the code has a bug and I want to get the code into a file so that I can take a proper look, and possibly fix it. how does one do this? (I mean getting the code into a file, not fixing the bug.) I sup

[R] a small question about R with Winbugs

2010-04-08 Thread dcflyer
I try to do a test for dirichlet process for Multivariate normal, but Winbugs always says "expected multivariate node", does that mean I miss something at initialization? I will really appreciate the help to solve this problem Here is the R code, and Winbugs code. model { for(i in 1:N)

Re: [R] erasing an area of a graph

2010-04-08 Thread Thomas Lumley
I don't think this is possible. With an opaque background you can get back the background color just by overwriting, but any additional painting can only increase the opacity so you can't get back to transparent. -thomas On Thu, 8 Apr 2010, Terry Therneau wrote: I have a case where th

Re: [R] how to manipulate object in specific environment?

2010-04-08 Thread Tengfei Yin
Hi Henrique, Thank you so much, that's exactly what I want! Thanks again Tengfei On Thu, Apr 8, 2010 at 3:28 PM, Henrique Dallazuanna wrote: > See ?eapply > > On Thu, Apr 8, 2010 at 5:01 PM, Tengfei Yin wrote: > > Hi > > > > I want to simplify my problem into a prototype, how to write a funct

[R] Placing the ≥ symbol in the Trellis custom strip

2010-04-08 Thread mahesh samtani
Hello, I am trying to use ≥ symbol in the Trellis custom strip. The ascii ALT Key for this symbol is 242. However, when I try "\242 90 kg" I get the ¢ symbol in the trellis custom strip. Can some one kindly help me? Thanking you in advance, MNS [[alternative HTML version deleted]] ___

Re: [R] how to manipulate object in specific environment?

2010-04-08 Thread Henrique Dallazuanna
See ?eapply On Thu, Apr 8, 2010 at 5:01 PM, Tengfei Yin wrote: > Hi > > I want to simplify my problem into a prototype, how to write a function to > get all the object in your current environment, e.g. .GlobalEnv, and print > their mode? > > For example, if I have object a,b,c... in my environmen

Re: [R] Okay, here is what I am doing

2010-04-08 Thread Romain Francois
Do you have the tools ? What operating system are you using ? What happens if you do this: > code <- '#include \nSEXP f(){\n return R_NilValue ; }' > writeLines( code, "test.c" ) > system( "R CMD SHLIB test.c" ) > dyn.load( "test.so" ) > .Call( "f" ) Romain Le 08/04/10 20:28, satu a écrit :

Re: [R] Code is too slow: mean-centering variables in a data framebysubgroup

2010-04-08 Thread Dimitri Liakhovitski
Dear everyone, I was not sure if I should start a new topic - but the task is the same, so I am staying within the original one. Originally, I stated that my data frame has a lot of NAs. Now I am discovering - it's having a lot of zeros (rather than NAs) - and they should be ignored when the subgro

Re: [R] xts off by one confusion or error

2010-04-08 Thread Tim Coote
I find the following even more confusing as I thought that xts was a subclass of zoo and I'd expected that the conversion would have been more transparent > aggregate (vv, as.yearmon(index(vv)), mean) Feb 2010 6.08 > xts (aggregate (vv, as.yearmon(index(vv)), mean)) x Jan 2010 6.

[R] Okay, here is what I am doing

2010-04-08 Thread satu
All is done in R 2.10.1 wiht the package "inline" version 0.3.4,,, this are the packages that I have loaded into the workspace > search() [1] ".GlobalEnv""package:inline""package:stats" "package:graphics" "package:grDevices" "package:datasets" "package:rcom" [8] "package:r

Re: [R] [R-pkgs] SOAR - Stored object caches for R

2010-04-08 Thread Emmanuel Charpentier
Le mercredi 07 avril 2010 à 18:03 +1000, William Venables a écrit : [ Snip ... ] > [ ... ] The effect is > somewhat like that of the use of the .Data directory in S-PLUS, (a > program not unlike R), though somewhat more manually driven. I'm not sure

Re: [R] How to locate the difference from two data frames

2010-04-08 Thread David Winsemius
On Apr 8, 2010, at 4:03 PM, Jun Shen wrote: David, all.equal() only tells how many mismatches there are including missing values but it doesn't tell me the location of each mismatch. Yes, I noticed that after further testing. I agree Charles' solution is more informative and I wonder if

Re: [R] estimating the starting value within a ODE using nls and lsoda

2010-04-08 Thread Thomas Petzoldt
Hi Dave, first of all, fitting starting values of a dynamic model the same way like its parameters is indeed the usual method. In that case parameters *and* some or all initial value(s) of the dynamic model are both in fact 'parameters' for the statistical model fitting problem. Fitting a no

Re: [R] How to locate the difference from two data frames

2010-04-08 Thread Jun Shen
David, all.equal() only tells how many mismatches there are including missing values but it doesn't tell me the location of each mismatch. For example, if I have one NA mismatch and three numerical mismatches, all.equal(a,b) gives [1] "Component 2: 'is.NA' value mismatch: 1 in current 0 in targe

[R] how to manipulate object in specific environment?

2010-04-08 Thread Tengfei Yin
Hi I want to simplify my problem into a prototype, how to write a function to get all the object in your current environment, e.g. .GlobalEnv, and print their mode? For example, if I have object a,b,c... in my environment, a=1;b='test';c=matrix(0,3,3). I want to write a function myfun(), whe

Re: [R] 3-D response surface using wireframe()

2010-04-08 Thread David Winsemius
On Apr 8, 2010, at 3:13 PM, array chip wrote: David, That does the job! Thanks a lot. Now I am very very close to what I want. Still have a couple of small adjustments to make. 1. I use drape=TRUE to draw grid and color on the surface, is there a parameter to adjust the density of the g

Re: [R] Reading dates in R using SQL and otherwise (and some interesting behavior by the data editor)

2010-04-08 Thread jim holtman
If you want to look at the dataframe, then consider using View. On Thu, Apr 8, 2010 at 11:14 AM, Paul Miller wrote: > Hello Everyone, > > I am a newbie with about a month's worth of experience using R. I've just > spent a little time learning how to work with date values. Mostly, this has > invo

Re: [R] Accessing elements of plm outputs

2010-04-08 Thread Achim Zeileis
On Thu, 8 Apr 2010, ECAMF wrote: Dear all, I've just migrated from STATA to R for runing panel regressions and I was very happy to discover the plm package. However, I have a problem when trying to access the "Total Sum of Squares" and "Residual Sum of Squares" on this output: summary(output

Re: [R] plm package twoways effect problem

2010-04-08 Thread Achim Zeileis
On Thu, 8 Apr 2010, seral wrote: Hello everyone, I have a peoblem to create the twoways effect in the plm package. when i try to create the following dsn1<-plm(lnQ~lnC+lnL+lnM+lnE+eco+RD,data=newdata,effect="twoways",model="within") i have this error: Error in rep.int(c(1, numeric(n)), n

Re: [R] 3-D response surface using wireframe()

2010-04-08 Thread array chip
David, That does the job! Thanks a lot. Now I am very very close to what I want. Still have a couple of small adjustments to make. 1. I use drape=TRUE to draw grid and color on the surface, is there a parameter to adjust the density of the grid? 2. Is there a way that I can add grid to the a

Re: [R] How to locate the difference from two data frames

2010-04-08 Thread David Winsemius
On Apr 8, 2010, at 1:34 PM, Jun Shen wrote: David, Thanks for the suggestion. Now I have worked out a general solution. Assume "a" and "b" are two data frames with same dimensions 1. Call identical(a,b) to get an overall assessment. If you get a FALSE 2. Call which(mapply(identical,unlist(

[R] erasing an area of a graph

2010-04-08 Thread Terry Therneau
I have a case where the easiest way to draw a particular symbol would be to draw something a little bigger, and then use polygon(... , col=0) to erase the extra stuff. Just how to do this best when par('bg') = 'transparent' is, however, eluding me. I've looked through the archives and the book R

Re: [R] incomplete final line found by readTableHeader

2010-04-08 Thread Leonardo K. Shikida
sorry, it was read, indeed. TIA Leonardo K. Shikida Vetta Labs +55(31)2551-6936 ext 203 http://www.vettalabs.com On Thu, Apr 8, 2010 at 3:43 PM, David Winsemius wrote: > > On Apr 8, 2010, at 2:14 PM, Leonardo K. Shikida wrote: > >> Hi >> >> I am trying this >> >>> x <- read.table("/home/kenj

Re: [R] incomplete final line found by readTableHeader

2010-04-08 Thread David Winsemius
On Apr 8, 2010, at 2:14 PM, Leonardo K. Shikida wrote: Hi I am trying this x <- read.table("/home/kenji/1245/GDS1_2grps_.cls", header = F, skip = 2) x <- read.table("/home/kenji/1246/MYCset.cls", header = F, skip = 2) Warning message: In read.table("/home/kenji/1246/MYCset.cls", header =

[R] incomplete final line found by readTableHeader

2010-04-08 Thread Leonardo K. Shikida
Hi I am trying this > x <- read.table("/home/kenji/1245/GDS1_2grps_.cls", header = F, skip = 2) > x <- read.table("/home/kenji/1246/MYCset.cls", header = F, skip = 2) Warning message: In read.table("/home/kenji/1246/MYCset.cls", header = F, skip = 2) : incomplete final line found by readTableHe

Re: [R] I can´t run the example shown in the inline package

2010-04-08 Thread Douglas Bates
On Thu, Apr 8, 2010 at 11:32 AM, satu wrote: > I want to run some R script using the inline package (which allows to create > and run inline C++ code in my humble understanding). > So, after loading the required packages and copy and paste the example that > runs C code (in the Reference Manual a

Re: [R] How to locate the difference from two data frames

2010-04-08 Thread Jun Shen
David, Thanks for the suggestion. Now I have worked out a general solution. Assume "a" and "b" are two data frames with same dimensions 1. Call identical(a,b) to get an overall assessment. If you get a FALSE 2. Call which(mapply(identical,unlist(a),unlist(b))==FALSE), you will get a result like

[R] RandomForest how to identify two classes when only one is present

2010-04-08 Thread JMark
I'm trying to do: randomForest(f, data = moths.train) But I get this error: Error in randomForest.default(m, y, ...) : Need at least two classes to do classification. When I look at the data for this, I realize there are no positive cases of this item: [1] 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0

Re: [R] reshape panel data

2010-04-08 Thread Gabor Grothendieck
See: http://n4.nabble.com/panel-data-td1749549.html On Thu, Apr 8, 2010 at 12:55 PM, Richard Saba wrote: > I have a data set with observations on 549 cities spanning  an 18 year > period. However, some of cities did not report in one or more of the 18 > years. I would like to implement the proce

[R] I can´t run the example shown in the inline pa ckage

2010-04-08 Thread satu
I want to run some R script using the inline package (which allows to create and run inline C++ code in my humble understanding). So, after loading the required packages and copy and paste the example that runs C code (in the Reference Manual as a PDF), I have a compilation error. Any body has eve

[R] Problem with mtext

2010-04-08 Thread Sebastian Leuzinger
Dear list I am experiencing a very annoying problem with mtext, although I have been using this command for many years. The following code prints "test" twice in the outer margin, once at .7 where it should be, and once at the bottom somewhere. I also notice that the command takes longer t

[R] LondonR meeting 4th May

2010-04-08 Thread Sarah Lewis
Good afternoon everyone, I am pleased to confirm the details of the next LondonR meeting: Date:Wednesday 4th May Time:6pm - 9pm Venue: The Shooting Star 125- 129 Middlesex Street E1 7JF (Nearest Tubes- Liverpool Street, Moorgate or Bank) I will distribu

Re: [R] general linear hypothesis testing for manova model

2010-04-08 Thread John Fox
Dear Philippe, The linear.hypothesis() function in the car package should do what you want. I hope this helps, John John Fox Senator William McMaster Professor of Social Statistics Department of Sociology McMaster University Hamilton, Ontario, Canada web: so

[R] texi2dvi runs but produces no output

2010-04-08 Thread David Hewitt
I am working on a Windows XP machine with R 2.10.1 and a recent installation of MiKTeX 2.8. I use LyX (www.lyx.org) to write documents and have it set up to run Sweave, Stangle, and make the PDF through R using a batch script and a MakeSweave.R file. This system worked just fine until I ran some Mi

[R] reshape panel data

2010-04-08 Thread Richard Saba
I have a data set with observations on 549 cities spanning an 18 year period. However, some of cities did not report in one or more of the 18 years. I would like to implement the procedure suggested by Wooldridge section 17.1.3 in his "Econometric analysis of cross section and panel data" to corre

Re: [R] help in attach function

2010-04-08 Thread Changbin Du
Thanks so much! Duncan, I appreciated! On Thu, Apr 8, 2010 at 5:03 AM, Duncan Murdoch wrote: > On 07/04/2010 4:24 PM, Changbin Du wrote: > >> Hi, r-community, >> >> This morning, I MET the following problem several times when I try to >> attach >> the data set. >> >> When I closed the current co

Re: [R] subsetting a matrix with specified no of columns

2010-04-08 Thread William Dunlap
> -Original Message- > From: r-help-boun...@r-project.org > [mailto:r-help-boun...@r-project.org] On Behalf Of Lee William > Sent: Thursday, April 08, 2010 4:40 AM > To: r-help@r-project.org > Subject: [R] subsetting a matrix with specified no of columns > > Hello! All, > > I am working

Re: [R] Error in leaps.setup

2010-04-08 Thread Thomas Lumley
On Wed, 7 Apr 2010, thedoctor81877 wrote: Hullo, I am trying to use the leaps package, & keep getting the following error: Error in leaps.setup(x, y, wt = wt, nbest = nbest, nvmax = NCOL(x) + int, : y and x different lengths x might be a data frame rather than a matrix. In any case, althou

Re: [R] Struggeling with svydesign()

2010-04-08 Thread Thomas Lumley
On Thu, 8 Apr 2010, ONKELINX, Thierry wrote: Dear Thomas, Thank you for your informative answer. We used epi.stratasize() to estimate the required sample size per stratum. Notice in the example below that it can select a sample size smaller than 2 in the very small strata. Would you recommend t

Re: [R] Problem using elements in a vector

2010-04-08 Thread Daniel Malter
This reads like homework. You should show some evidence where you are stuck or pick up an R book/manual/introduction after which you should be able to do this yourself quite easily. Daniel - cuncta stricte discussurus - - cu

Re: [R] Extracting specific rows from irregular zoo object and merging with a regular zoo object

2010-04-08 Thread Gabor Grothendieck
On Thu, Apr 8, 2010 at 11:42 AM, Sergey Goriatchev wrote: > Thank you, Gabor! This is a very elegant solution. > But instead of general last day of month in the index, how can I have > last day of each month as they are presented in "a", for example, not > March 31, but March 27? > Try this: > a

[R] general linear hypothesis testing for manova model

2010-04-08 Thread Philippe Hupé
Hello, I have a MANOVA model and I want to test the following hypothesis: LBM = 0 where B is the parameter estimates. Is there any function to do this in R? Cheers, Philippe -- Philippe Hupé Institut Curie, CNRS UMR 144, INSERM U900 26 rue d'Ulm 75005 Paris - France Email : philippe

Re: [R] 3-D response surface using wireframe()

2010-04-08 Thread array chip
Scott, This is a good explanation and a good practice. Thank you, John --- On Thu, 4/8/10, Waichler, Scott R wrote: > From: Waichler, Scott R > Subject: Re: 3-D response surface using wireframe() > To: "arrayprof...@yahoo.com" > Cc: "r-help@r-project.org" > Date: Thursday, April 8, 2010, 9

Re: [R] Strange csv parsing problem

2010-04-08 Thread Peter Ehlers
On 2010-04-08 9:10, Hadley Wickham wrote: Remove the comma and count.fields gives 11 for all rows. From your other post(s) on escaped quotes, I assume that this won't solve your problem with the existing files. (: Right - but assuming I'm not crazy, that should cause an error in read.csv, righ

Re: [R] square root of inverse

2010-04-08 Thread David Winsemius
On Apr 8, 2010, at 11:28 AM, arindam fadikar wrote: On Thu, Apr 8, 2010 at 5:38 PM, David Winsemius > wrote: On Apr 8, 2010, at 1:45 AM, arindam fadikar wrote: Dear users, How to get a symmetric square root of a positive definite matrix? I have tried using spectral decomposition, but so

Re: [R] square root of inverse

2010-04-08 Thread Charles C. Berry
On Thu, 8 Apr 2010, arindam fadikar wrote: On Thu, Apr 8, 2010 at 5:38 PM, David Winsemius wrote: On Apr 8, 2010, at 1:45 AM, arindam fadikar wrote: Dear users, How to get a symmetric square root of a positive definite matrix? I have tried using spectral decomposition, but some eigen valu

Re: [R] Extracting specific rows from irregular zoo object and merging with a regular zoo object

2010-04-08 Thread Sergey Goriatchev
Thank you, Gabor! This is a very elegant solution. But instead of general last day of month in the index, how can I have last day of each month as they are presented in "a", for example, not March 31, but March 27? Regards, Sergey On Thu, Apr 8, 2010 at 17:27, Gabor Grothendieck wrote: > Omit re

Re: [R] square root of inverse

2010-04-08 Thread baptiste auguie
try this, install.packages("expm", repos="http://R-Forge.R-project.org";) On 8 April 2010 17:28, arindam fadikar wrote: > On Thu, Apr 8, 2010 at 5:38 PM, David Winsemius wrote: > >> >> On Apr 8, 2010, at 1:45 AM, arindam fadikar wrote: >> >>  Dear users, >>> >>> How to get a symmetric square roo

Re: [R] Extracting specific rows from irregular zoo object and merging with a regular zoo object

2010-04-08 Thread Gabor Grothendieck
Omit rep. You just want a <- zoo(1:9, ...). To get the last day of the month you don`t need b since as.Date.yearmon will give it with the argument frac = 1: > aggregate(a, as.Date(as.yearmon(time(a)), frac = 1), tail, 1) 2009-03-31 2009-04-30 2009-05-31 2009-06-30 2 5

[R] plm package twoways effect problem

2010-04-08 Thread seral
Hello everyone, I have a peoblem to create the twoways effect in the plm package. when i try to create the following dsn1<-plm(lnQ~lnC+lnL+lnM+lnE+eco+RD,data=newdata,effect="twoways",model="within") i have this error: Error in rep.int(c(1, numeric(n)), n - 1L) : negative length vectors are

Re: [R] square root of inverse

2010-04-08 Thread arindam fadikar
On Thu, Apr 8, 2010 at 5:38 PM, David Winsemius wrote: > > On Apr 8, 2010, at 1:45 AM, arindam fadikar wrote: > > Dear users, >> >> How to get a symmetric square root of a positive definite matrix? I have >> tried using spectral decomposition, but some eigen values come out to be >> complex. Is t

[R] Extracting specific rows from irregular zoo object and merging with a regular zoo object

2010-04-08 Thread Sergey Goriatchev
Hello, everyone I have the following problem: Say I have an irregular zoo timeseries like this: a <- zoo(rep(1:9), as.Date(c("2009-03-20", "2009-03-27", "2009-04-24", "2009-04-25", "2009-04-30", "2009-05-15", "2009-05-22", "2009-05-29", "2009-06-26"))) and I have regular zoo timeseries like this

[R] Reading dates in R using SQL and otherwise (and some interesting behavior by the data editor)

2010-04-08 Thread Paul Miller
Hello Everyone,   I am a newbie with about a month's worth of experience using R. I've just spent a little time learning how to work with date values. Mostly, this has involved converting text values into dates.   So far, I've managed to figure out how to do this in R proper using as.Date. How

Re: [R] Strange csv parsing problem

2010-04-08 Thread Hadley Wickham
> Remove the comma and count.fields gives 11 for all rows. > From your other post(s) on escaped quotes, I assume that > this won't solve your problem with the existing files. (: Right - but assuming I'm not crazy, that should cause an error in read.csv, right? It shouldn't just parse the file reg

[R] xts off by one confusion or error

2010-04-08 Thread Tim Coote
Hullo I may have missed something blindingly obvious here. I'm using xts to handle some timeseries data. I've got daily measurements for 100 years. If I try to reduce the error rate by taking means of each month, I'm getting what at first sight appears to be conflicting information. Here's

Re: [R] Using read.table to read file created with read.table and qmethod = "escape"

2010-04-08 Thread David Winsemius
On Apr 8, 2010, at 10:01 AM, Hadley Wickham wrote: Can write.table and read.table really be so asymmetric? write() is a wrapper for cat() and read() is a wrapper for scan() so the question should really be can cat() and scan() be so asymmetric. Looking at their help pages, I would say tha

Re: [R] Exchanging zoo object dates

2010-04-08 Thread Gabor Grothendieck
Assuming they are of the same length try this: > library(zoo) > # test data > A <- zoo(1:3, Sys.Date() + 1:3) > B <- zoo(4:6, Sys.Date() + 14:16) > > time(A) <- time(B) > A 2010-04-22 2010-04-23 2010-04-24 1 2 3 Next time please provide test data with your post. On Thu

Re: [R] RWeka - Error when attempting to summary() model

2010-04-08 Thread D. Dashcle
Whew, figured it out through trial and error. In case anyone else runs into this problem, the issue ended up being with the data in one of the columns. I knew I didn't have any actual missing values, but one of the columns is a text field which can have the literal value of "NA". I guess R wa

[R] C-index and Cox model

2010-04-08 Thread Bessy
Dear all R users, I am building a Cox PH model on a small dataset. I am wondering how to measure the predictive power of my cox model? Normally the ROC curve or Gini value are used in logistic regression model. Is there any similar measurement suitable for Cox model? Also if I use C-index statis

[R] Odp: Question on using elements of a vector

2010-04-08 Thread Petr PIKAL
Hi r-help-boun...@r-project.org napsal dne 08.04.2010 16:23:53: > > Hi > > So my particular problem is this: > > I have a row vector of length 5200 elements - specifically created by > > x<-rbinom(5200,1,0.5) > y<-matrix(x,nrow=1,ncol=5200) > y > > now, each element is either a 0 or a

[R] Exchanging zoo object dates

2010-04-08 Thread Research
Hi, I have two zoo objects (time series of same frequency) say A and B. I need to exchange A's dates for B's. Is there and easy way? I managed to do it by converting A to a vector and pasting it on a zoo vector (all ones) with B's dates but I wonder if there is an easier way by some "zoo

Re: [R] Strange csv parsing problem

2010-04-08 Thread Peter Ehlers
Hadley, The cause of the count.fields result is the comma in 'nftc,%20' at about column 300 (for me). Since commas between quotes should normally not matter, this must be due to the comma appearing inside escaped quotes, i.e. we have: "abc\"def,ghi\"jkl". Remove the comma and count.fields gives

Re: [R] Problem using elements in a vector

2010-04-08 Thread jim holtman
just convert your vector from 0,1 to .995,1.005 and use cumprod On Thu, Apr 8, 2010 at 10:22 AM, Redhwan wrote: > > Hi > > So my particular problem is this: > > I have a row vector of length 5200 elements - specifically created by > > x<-rbinom(5200,1,0.5) > y<-matrix(x,nrow=1,ncol=5200) > y > >

[R] Accessing elements of plm outputs

2010-04-08 Thread ECAMF
Dear all, I've just migrated from STATA to R for runing panel regressions and I was very happy to discover the plm package. However, I have a problem when trying to access the "Total Sum of Squares" and "Residual Sum of Squares" on this output: > summary(output) Oneway (individual) effect Withi

[R] Question on using elements of a vector

2010-04-08 Thread redhwan zaman
Hi So my particular problem is this: I have a row vector of length 5200 elements - specifically created by x<-rbinom(5200,1,0.5) y<-matrix(x,nrow=1,ncol=5200) y now, each element is either a 0 or a 1 - e.g. it could be (0,1,1,1,1,0,0,0,1,1,1) e.t.c. when the element is a 1, i need to

  1   2   >