[R] residual standard error in rlm (MASS package)

2008-12-07 Thread Kari Ruohonen
Hi, I would appreciate of someone could explain how the residual standard error is computed for rlm models (MASS package). Usually, one would expect to get the residual standard error by > sqrt(sum((y-fitted(fm))^2)/(n-2)) where y is the response, fm a linear model with an intercept and slope for

[R] About adf.test

2008-12-07 Thread Kamlesh Kumar
Dear sir, I am a new user of R statistical package. I want to perform adf.test(augmented dickey fuller test), which packages I need to install in order to perform it. I am getting following message on my monitor. *x<-rnorm(1000) > adf.test(x) Error: could not find function "adf.test" *I am wai

Re: [R] Logical inconsistency

2008-12-07 Thread Patrick Connolly
On Mon, 08-Dec-2008 at 02:05AM +0800, Berwin A Turlach wrote: |> G'day Wacek, |> |> On Sat, 06 Dec 2008 10:49:24 +0100 |> Wacek Kusnierczyk <[EMAIL PROTECTED]> wrote: |> |> [] |> > >> there is, in principle, no problem in having a high-level language |> > >> perform the computation in a logi

[R] DLM - Covariates in the system equation

2008-12-07 Thread jens . keller
Is there a way to add covariates to the system equation in a time-varying approach: Y[t] = F'[t]theta[t] + v[t], v[t] ~ N[0,V] #observation equation theta[t] = theta[t-1] + psi*Z[t] + w[t], w[t] ~ N[0,W] #system equation While F[t] is a matrix of regressors to capture the short term effect on

[R] Reading txt file in R to run Random Intercept Model

2008-12-07 Thread Anamika Chaudhuri
I am using a random intercept model with SITEID as random and NAUSEA as outcome. Thanks. Anamika I tried using a dataset without missing values and changed my model statement accordingly but still get the same error. Follwoing in an excerpt. > anal.data <- read.table("nausea.txt", header=T, sep=

Re: [R] Submit R Package

2008-12-07 Thread Erik Iverson
See the Writing R Extensions manual, specifically section 1.5. [EMAIL PROTECTED] wrote: Hi, My name is Jun Mao and I am a graduate student at University of Ottawa. My research topic is multivariate quality control. I did my simulation in R. My supervisor and me develop a new nonparametric cusum

[R] Submit R Package

2008-12-07 Thread jmao034
Hi, My name is Jun Mao and I am a graduate student at University of Ottawa. My research topic is multivariate quality control. I did my simulation in R. My supervisor and me develop a new nonparametric cusum method. We want to edit as a R package and submit it as standard package to R. Can you tel

[R] Compile Packages on vista

2008-12-07 Thread Dominik Locher - bondsearch.ch
Hi I'm trying to compile R packages on my vista (I'm very new on vista...). I installed Rtools, RExcel on a specific folder: c:\Rtools and gave full access. Unfortunately, I am still unable to compile any packages (may be still because of the security properties of vista). I checked several mai

Re: [R] subsetting large data frames.

2008-12-07 Thread hesicaia
It worked wonderfully - Thanks very much! hesicaia wrote: > > Hi all, > I have a question regarding subsetting of large data frames. I have two > data frames “catches” and “tows” and they both have the same 30 variables > (columns). I would like to select rows in the data frame “tows” where

Re: [R] xspline, graphical parameters and MAXNUMPTS

2008-12-07 Thread Paul Murrell
Hi Keith Ponting wrote: > Hello, > > I am having two difficulties with xspline: > > 1) Passing lty=2 (via ...) appears to have no effect > > 2) Apparently depending on the current plot axes, I may or may not > get the failure: add_point - reached MAXNUMPTS (25200) Both of these prob

Re: [R] Logical inconsistency

2008-12-07 Thread Wacek Kusnierczyk
Stavros Macrakis wrote: > On Sun, Dec 7, 2008 at 3:51 AM, Wacek Kusnierczyk < > [EMAIL PROTECTED]> wrote: > > (* (/ 2.0 3.0) 3.0) is not exact either, as aren't (* (/ 2.0 2.0) >> 2.0)... >> >>> Actually, they *are* all exact in any system using IEEE floats. >>> >>

Re: [R] Logical inconsistency

2008-12-07 Thread Wacek Kusnierczyk
Berwin A Turlach wrote: > G'day Wacek, > g'evening. > On Sat, 06 Dec 2008 10:49:24 +0100 > Wacek Kusnierczyk <[EMAIL PROTECTED]> wrote: > > [] > there is, in principle, no problem in having a high-level language perform the computation in a logically consistent way.

Re: [R] Reading txt file in R

2008-12-07 Thread Anamika Chaudhuri
I tried using a dataset without missing values and changed my model statement accordingly but still get the same error. Follwoing in an excerpt. > anal.data <- read.table("nausea.txt", header=T, sep="\t") > list(names(anal.data)) [[1]] [1] "SITEID" "NAUSEA" > #anal.data <- read.csv("simuldat.csv",

Re: [R] Logical inconsistency

2008-12-07 Thread Stavros Macrakis
On Sun, Dec 7, 2008 at 3:51 AM, Wacek Kusnierczyk < [EMAIL PROTECTED]> wrote: > >> (* (/ 2.0 3.0) 3.0) is not exact either, as aren't (* (/ 2.0 2.0) > 2.0)... > > Actually, they *are* all exact in any system using IEEE floats. > not per definitionem of exactness as of r6rs, as of my understanding.

Re: [R] How to calculate words in column?

2008-12-07 Thread eduardo san miguel
> Hi, > > I have a table for an 1 week exam result for many classes in school, > like > this: > > Day Class_ID TestResult > 1 Monday1 Paper Passed > 2 Tuesday1 Oral Passed > 3 Friday 1 Paper Passed > 4 Mond

Re: [R] Logical inconsistency

2008-12-07 Thread Ted Harding
On 07-Dec-08 18:41:16, Charles C. Berry wrote: > On Mon, 8 Dec 2008, Berwin A Turlach wrote: >> G'day Wacek, >> On Sat, 06 Dec 2008 10:49:24 +0100 >> Wacek Kusnierczyk <[EMAIL PROTECTED]> wrote: >> >> [] > there is, in principle, no problem in having a high-level language > perform the

Re: [R] subsetting large data frames.

2008-12-07 Thread Marc Schwartz
on 12/07/2008 11:16 AM hesicaia wrote: > Hi all, > I have a question regarding subsetting of large data frames. I have two > data frames “catches” and “tows” and they both have the same 30 variables > (columns). I would like to select rows in the data frame “tows” where all 5 > specific variables

Re: [R] quartz() and windows()

2008-12-07 Thread Prof Brian Ripley
On Sun, 7 Dec 2008, Marc Schwartz wrote: on 12/07/2008 10:17 AM Nino Hardt wrote: Hi, when windows and mac users collaborate, one always has to use search&replace on the quartz() function. Is there a better way? Some command which tells whether one is working in a Windows or OSX setting? Se

Re: [R] Logical inconsistency

2008-12-07 Thread Charles C. Berry
On Mon, 8 Dec 2008, Berwin A Turlach wrote: G'day Wacek, On Sat, 06 Dec 2008 10:49:24 +0100 Wacek Kusnierczyk <[EMAIL PROTECTED]> wrote: [] there is, in principle, no problem in having a high-level language perform the computation in a logically consistent way. Is this now supposed to b

Re: [R] How to look within .Internal ?

2008-12-07 Thread David Winsemius
I think it a problem that is local to you. In particular the optim.c code appears available. Perhaps you should determine how to force your browser to refresh a page. -- David Winsemius On Dec 7, 2008, at 1:13 PM, megh wrote: https://s

Re: [R] quartz() and windows()

2008-12-07 Thread Nino Hardt
Hi, thanks for your quick reply. I just added the following in front of everything else in the script: if(.Platform$OS.type=="windows") { quartz<-function() windows() } Works as expected. Thanks, Nino -Ursprüngliche Nachricht- Von: Marc Schwartz [mailto:[EMAIL PROTECTED] Gesendet

Re: [R] quartz() and windows()

2008-12-07 Thread David Winsemius
One way (from my MacPro OS X 10.5.5): > .Platform$OS.type [1] "unix" Another: > Sys.info()["sysname"] sysname "Darwin" The help pages say NOT to do this: > R.version$os [1] "darwin9.5.0" -- David Winsemius On Dec 7, 2008, at 11:17 AM, Nino Hardt wrote: Hi, when windows and mac users

Re: [R] How to look within .Internal ?

2008-12-07 Thread megh
https://svn.r-project.org/R/trunk/src/main is not opening for last few days. Is there any problem with this or the materials were moved to different address? Duncan Murdoch-2 wrote: > > On 11/19/2008 10:13 AM, megh wrote: >> In the optim() function there is a syntax : >> >> res <- .Internal(op

Re: [R] Finding the first value without warning in a loop

2008-12-07 Thread Gabor Grothendieck
log(-1) is not an error in R bug it does generate a warning and a NaN result. If there is a warning then the statement that causes the warning and all remaining statements in the tryCatch are not executed. Instead the warning= function is invoked. On Sun, Dec 7, 2008 at 1:09 PM, David Winsemius

Re: [R] quartz() and windows()

2008-12-07 Thread Marc Schwartz
on 12/07/2008 10:17 AM Nino Hardt wrote: > Hi, > > when windows and mac users collaborate, one always has to use search&replace > on the quartz() function. > > Is there a better way? Some command which tells whether one is working in a > Windows or OSX setting? See ?.Platform HTH, Marc Schwar

Re: [R] Finding the first value without warning in a loop

2008-12-07 Thread David Winsemius
Thanks for that. I am having some difficulty figuring out how it works. The help page tells me (I think) that "y<-log(x)" gets matched to expr. Am I correct in thinking that if either an error or warning is produced, that tryCatch silently returns (or ?) to the for loop, and only otherwi

Re: [R] Logical inconsistency

2008-12-07 Thread Berwin A Turlach
G'day Wacek, On Sat, 06 Dec 2008 10:49:24 +0100 Wacek Kusnierczyk <[EMAIL PROTECTED]> wrote: [] > >> there is, in principle, no problem in having a high-level language > >> perform the computation in a logically consistent way. > > > > Is this now supposed to be a "Radio Eriwan" joke? As a

Re: [R] How to force aggregate to exclude NA ?

2008-12-07 Thread hadley wickham
On Sun, Dec 7, 2008 at 10:10 AM, Daren Tan <[EMAIL PROTECTED]> wrote: > > How to use the na.rm function outside aggregate ? I tried > > na.rm <- function(f) { > function(x, ...) f(x[!is.na(x)], ...) > } > > >>na.rm(sum(c(NA,1,2))) > > function(x, ...) f(x[!is.na(x)], ...) > > >> na.rm(sum, c(NA,1,

[R] subsetting large data frames.

2008-12-07 Thread hesicaia
Hi all, I have a question regarding subsetting of large data frames. I have two data frames “catches” and “tows” and they both have the same 30 variables (columns). I would like to select rows in the data frame “tows” where all 5 specific variables are NOT matched in “catches. That is to say, th

[R] quartz() and windows()

2008-12-07 Thread Nino Hardt
Hi, when windows and mac users collaborate, one always has to use search&replace on the quartz() function. Is there a better way? Some command which tells whether one is working in a Windows or OSX setting? Thanks Nino __ R-help@r-project.org mailin

Re: [R] How to force aggregate to exclude NA ?

2008-12-07 Thread Daren Tan
How to use the na.rm function outside aggregate ? I tried na.rm <- function(f) { function(x, ...) f(x[!is.na(x)], ...) } >na.rm(sum(c(NA,1,2))) function(x, ...) f(x[!is.na(x)], ...) > na.rm(sum, c(NA,1,2)) Error in na.rm(sum, c(NA, 1, 2)) : unused argument(s) (c(NA, 1, 2)) > Date:

Re: [R] Reading txt file in R

2008-12-07 Thread Anamika Chaudhuri
I have some missing values in the first few rows for some elements. But when I am reading it using the command   anal.data <- read.table("nausea.txt", header=T, sep="\t")  they come up as NA for those fields. --- On Sun, 12/7/08, jim holtman <[EMAIL PROTECTED]> wrote: From: jim holtman <[EMAIL P

[R] custom panel help in lattice

2008-12-07 Thread Jon Loehrke
Hi, I am having an issue with a custom panel for lattice. The problem comes when I try passing a groups argument. Here is the custom panel, a wrapper for smooth spline. I copied panel.loess and replaced the loess arguments with smooth.spline(). [Note: I would like to use the cross-validat

Re: [R] Finding the first value without warning in a loop

2008-12-07 Thread Gabor Grothendieck
Try this: for (x in c(-2, 2, 4)) { tryCatch({ y <- log(x) xx <- x break }, warning = function(w) {}) } print(xx) # 2 On Sun, Dec 7, 2008 at 2:38 AM, Andreas Wittmann <[EMAIL PROTECTED]> wrote: > Dear R useRs, > > with the following

Re: [R] concordance correlation coefficient using R

2008-12-07 Thread Marc Schwartz
on 12/07/2008 09:23 AM paul murima wrote: > Hi. > I have data which i would want to assess the degree of agreement > between two assays, e.g., to evaluate reproducibility or for > inter-rater reliability. I have used the Pearson product-moment > correlation coefficient. It looks good ranginging b

Re: [R] confint.glm(...) fails for binomial count data format

2008-12-07 Thread Prof Brian Ripley
For the record, this is because that example has a useless row (row 24 has no respondents and so adds nothing). confint() works if you remove the pointless row. We'll add a precautionary check in due course, but such datasets are unsurprisingly rare. On Sun, 16 Nov 2008, Xiaoxu LI wrote:

Re: [R] Finding the first value without warning in a loop

2008-12-07 Thread David Winsemius
Have you considered instead sending the warnings to someplace where it won't bother the user? If so then sink() might be useful. My reading of the help page suggests that your call to suppressWarnigs is storing any results outside the Global environment. This is what I came up with. It may

[R] Vars package - specification of VAR

2008-12-07 Thread herrdittmann
Hi useRs, Been estimating a VAR with two variables, using VAR() of the package "vars". Perhaps I am missing something, but how can I include the present time t variables, i.e. for the set of equations to be: x(t) = a1*y(t) + a2*y(t-1) + a3*x(t-1) + ... Y(t) = a1*x(t) + a2*x(t-1) + a3*y(t-1) + .

Re: [R] concordance correlation coefficient using R

2008-12-07 Thread Bruno Falissard
You can look at the fonction icc in the package psy. Best regards, Bruno Bruno Falissard INSERM U669, PSIGIAM "Paris Sud Innovation Group in Adolescent Mental Health" Maison de Solenn 97 Boulevard de Port Royal 75679 P

Re: [R] alternative way to replicate()

2008-12-07 Thread jim holtman
Is this what you want: > paste(rep('2',5), collapse=',') [1] "2,2,2,2,2" > On Wed, Dec 3, 2008 at 5:36 AM, Johannes Hüsing <[EMAIL PROTECTED]> wrote: > Am 03.12.2008 um 09:06 schrieb Liviu Andronic: > >> Dear all, >> >> I'm looking for an alternative way to replicate the "2," string for an >> x

Re: [R] Reading txt file in R

2008-12-07 Thread jim holtman
In your sample data, the first 9 lines do not have the same number of elements as the rest. What are they supposed to represent? How do you intend to read them in and use them? On Sat, Dec 6, 2008 at 10:42 PM, Anamika Chaudhuri <[EMAIL PROTECTED]> wrote: > > > > > > > > > Hi: > > I am using the

[R] concordance correlation coefficient using R

2008-12-07 Thread paul murima
Hi. I have data which i would want to assess the degree of agreement between two assays, e.g., to evaluate reproducibility or for inter-rater reliability. I have used the Pearson product-moment correlation coefficient. It looks good ranginging between 0.90 to 0.998. Though this looks good. I am t

Re: [R] How to force aggregate to exclude NA ?

2008-12-07 Thread Gabor Grothendieck
Actually the second aggregate and second rowsum don't need the na.rm = TRUE so we only need: aggregate(!is.na(m[, -(1:2)]), m[1], sum) rowsum(0+!is.na(m[, -(1:2)]), m[,1]) You might also want to look at summaryBy in the doBy package. On Sun, Dec 7, 2008 at 7:43 AM, Gabor Grothendieck <[EMAIL PRO

Re: [R] How to force aggregate to exclude NA ?

2008-12-07 Thread hadley wickham
>> aggregate(m[,-c(1:2)], by=list(m[,1]), mysum) <- this >> computes correctly. > Group.1 C D > 1 A 3 2 > 2 B 15 13 > 3 C 10 10 > 4 D 6 7 > 5 E 9 8 > >> aggregate(m[,-c(1:2)], by=list(m[,1]), mylength) <- this >> computes co

Re: [R] How to force aggregate to exclude NA ?

2008-12-07 Thread Mike Lawrence
This should work. I updated a personal modification of aggregate that I made to facilitate return of multiple values if necessary: #modified aggregate command, implementing na.rm for all functions and allowing for multiple and/or named return values values agg=function(z,Ind,FUN,na.rm=F,...){ if(na

Re: [R] How to force aggregate to exclude NA ?

2008-12-07 Thread Gabor Grothendieck
Try aggregate(m[, -(1:2)], m[1], sum, na.rm = TRUE) aggregate(!is.na(m[, -(1:2)]), m[1], sum, na.rm = TRUE) # or (this uses row names rather than a column for the group): rowsum(m[, -(1:2)], m[,1], na.rm = TRUE) rowsum(0+!is.na(m[, -(1:2)]), m[,1], na.rm = TRUE) On Sun, Dec 7, 2008 at 7:06 AM,

[R] How to force aggregate to exclude NA ?

2008-12-07 Thread Daren Tan
The aggregate function does "almost" all that I need to summarize a datasets, except that I can't specify exclusion of NAs without a little bit of hassle. > set.seed(143) > m <- data.frame(A=sample(LETTERS[1:5], 20, T), B=sample(LETTERS[1:10], 20, > T), C=sample(c(NA, 1:4), 20, T), D=sample(c

Re: [R] Help with maps

2008-12-07 Thread zerfetzen
I'm brand new to the map function too, here's my attempt at coloring a map of the states according to a rate (rather than count): map('state')$names MyCount <- c(1:63); MyRate <- runif(63, 0, 1) map('state', fill=TRUE, col=rgb((1-MyRate),MyRate,0,1)) Seeing that there are 63 "states", means you'

[R] Reading txt file in R

2008-12-07 Thread Anamika Chaudhuri
Hi:   I am using the following code to read a data set in txt in R and using the follwoing model. But it seems to give me an error ' expected variable name error pos 134022'. Any help is greatly appreciated.   Code: anal.data <- read.table("nausea.txt", header=T, sep="\t") list(names(anal

[R] Generating output from auto.arima()

2008-12-07 Thread Evan DeCorte
I have several hundred times series data sets and I am trying to use auto.arima(), in the forecasting package, to take a first stab at fitting an ARIMA model to each set. Ideally I would like to loop through each time series use auto.arima() to fit a model and output the R^2 of the model and the pa

Re: [R] Sink does not send graphs to sink file

2008-12-07 Thread Jim Lemon
John Sorkin wrote: Wiindows XP R 2.7 I am using sink() to send the results of my analyses to a text file. Unfortunately my graphs do not become part of the file. Is there anyway that I can have both the text and graphic output of my analyses appear in a file? Hi John, Both htmlize in the pr

[R] R - how to measure the distance?

2008-12-07 Thread porzycka
Hello, I have been worked with R for 3 weeks. I have one problem. I could not find the answer on it on web pages. I do not know how to measure the shortes distance between point (Lon/Lat) and line. I used spatstat package and distmap() but I want to calculate these distances only for particular poi

Re: [R] Logical inconsistency

2008-12-07 Thread Wacek Kusnierczyk
Stavros Macrakis wrote: > On Sat, Dec 6, 2008 at 4:32 PM, Wacek Kusnierczyk < > [EMAIL PROTECTED]> wrote: > > >> Stavros Macrakis wrote: >> >>> On Sat, Dec 6, 2008 at 5:02 AM, Wacek Kusnierczyk < >>> [EMAIL PROTECTED]> wrote: >>> yepp, though (2/3)*3 not evaluating to 2 is again

Re: [R] logical inconsistency

2008-12-07 Thread Peter Dalgaard
John C Nash wrote: This actually goes back a very long way. Peter is right to remind us that "optimizers" (in the sense of compilers) can corrupt algorithms that are well-designed. Optimizing in tests is something some of us have fought for nearly 40 years, but compiler writers don't do much