Re: [R] Jarque-Bera test

2010-11-16 Thread Dennis Murphy
Hi: The input to jarque.bera.test() is a numeric vector or time series. Try running the function str() on your input object to see if it is of the correct type. If you have a vector that is not numeric or a time series object, you need to convert it to one with something like as.numeric(myvec). Th

Re: [R] Population abundance, change point

2010-11-16 Thread Michael Bedward
Hi Nick, I've used MCMC to fit change point regressions to a variety of ecological data and prefer this approach to strucchange and similar because I feel I have more control over the model, ie. I find it easier to tailor the form of the model to biological / demographic processes. I also find the

Re: [R] Odp: Sampling problem

2010-11-16 Thread wangwallace
I figured it out myself. Again, Michael and Petr, many thanks to both of you!!! :) -- View this message in context: http://r.789695.n4.nabble.com/Sampling-problem-tp3043804p3046161.html Sent from the R help mailing list archive at Nabble.com. __ R-h

Re: [R] L-shaped boxes with lattice graphs?

2010-11-16 Thread Felix Andrews
Here is a better approach that will keep the axis ticks as well on the two axes. ## define a lattice "axis function" axis.L <- function(side, ..., line.col) { if (side %in% c("bottom", "left")) { col <- trellis.par.get("axis.text")$col axis.default(side, ..., line.col = col

Re: [R] Fatal Error R

2010-11-16 Thread Kenneth Roy Cabrera Torres
As long as the names are unique, there is not a problem to shorten them. El mié, 17-11-2010 a las 01:02 +0100, José Fernando Zea Castro escribió: > Hello. > > First, I'm thankful about your wonderful project. > > However, I have serious worries about the reliability of R. I found > the next bug

Re: [R] Odp: Sampling problem

2010-11-16 Thread Dennis Murphy
Hi: Try this: # Function to generate one sample from the data frame sampler <- function(df) { s1 <- sample(nrow(df), 1, replace = FALSE) s2 <- sample(setdiff(1:nrow(df), s1), 2, replace = FALSE) list(sample1 = df[s1, grep('^C', names(df))], sample2 = df[s2, grep('^W', nam

Re: [R] Fatal Error R

2010-11-16 Thread David Winsemius
On Nov 16, 2010, at 7:02 PM, José Fernando Zea Castro wrote: Hello. First, I'm thankful about your wonderful project. However, I have serious worries about the reliability of R. I found the next bug which I consider important because in my job everytime We work with datanames like next. Pleas

Re: [R] Jarque-Bera test

2010-11-16 Thread Uwe Ziegenhagen
2010/11/17 Kiana Basiri > Hello, > I'm so confused why I can't run Jarque-Bera test on my data. I have 9968 > observation and I want to run Jarque-Bera test on them, but no matter how > hard I am trying I can't get it work. please let me know what should I do. > > Best, > Kiana > > Did you check

Re: [R] Non-positive definite cross-covariance matrices

2010-11-16 Thread Mike Marchywka
> Date: Tue, 16 Nov 2010 17:39:57 -0800 > From: peter.langfel...@gmail.com > To: jbass...@cs.gmu.edu > CC: r-help@r-project.org > Subject: Re: [R] Non-positive definite cross-covariance matrices > > > Peter, > > > > I see your point. As it turns out

[R] Fatal Error R

2010-11-16 Thread José Fernando Zea Castro
Hello. First, I'm thankful about your wonderful project. However, I have serious worries about the reliability of R. I found the next bug which I consider important because in my job everytime We work with datanames like next. Please see below: b=data.frame(matrix(1:9,ncol=3)) names(b)=c("q99

Re: [R] Aggregate on identical link attributes

2010-11-16 Thread LCOG1
Okay here is a solution that works in less than 60 minutes but i feel likes its messy, if anyone has an alternative solution i would very much appreciate your insights. #Create test data TNode<-c(1:20,21) FNode<-c(rev(1:20),22) Volume<-c(rep(100,20),200) ClassCode=c(rep("Local",20),rep("Freeway

[R] Jarque-Bera test

2010-11-16 Thread Kiana Basiri
Hello, I'm so confused why I can't run Jarque-Bera test on my data. I have 9968 observation and I want to run Jarque-Bera test on them, but no matter how hard I am trying I can't get it work. please let me know what should I do. Best, Kiana [[alternative HTML version deleted]] __

Re: [R] Offset in glm poisson using R vs Exposure in Stata

2010-11-16 Thread Columbine Caroline Waring
Ben, Thank you for your assistance. Going back to basics and using the data set as you suggested has resulted in a win. Set A works! using +offset(log(variable)) or ,offest=(log(Eff)) is the same as using exposure(variable) program stata. I went back and isloated a problem with code be

[R] changing the limits of a secondary y-axis in a barplot

2010-11-16 Thread Anna.Richards
Hi, I hope this is a simple question. I am having trouble changing the scale of a secondary y-axis on a barplot. When I run the code below the limits set for the first axis are always applied to the second axis as well. I am using the latest R version 2.12.0. For example, if I have 3 vectors

[R] Error: package 'pcvsuite' was built before R 2.10.0: please re-install it

2010-11-16 Thread Brant Inman
R-helpers, I have had difficulty installing the "pcvsuite" package on R version 2.12.0 (2010-10-15). The pcvsuite package is not available on CRAN, but is located for download at the following website at the University of Washington: Windows version http://labs.fhcrc.org/pepe/dabs/pcvsuite_1.

Re: [R] Fit a distribution to an "ECDF"

2010-11-16 Thread Frank Harrell
Fitting curves to an ECDF will result in a fit that has the same precision as the ECDF if variances are calculated correctly. So why not stop with the ECDF as your estimator? Frank - Frank Harrell Department of Biostatistics, Vanderbilt University -- View this message in context: http://r

Re: [R] Please, help me with 'mattern' variogram

2010-11-16 Thread David Cross
I think the problem is with the (2,2) element in your hessian, unless that is a typo. Cheers David Cross d.cr...@tcu.edu www.davidcross.us On Nov 16, 2010, at 8:33 PM, Jimmy Martina wrote: Hi, R-folks: I have been tryin many combination of parameter to make Matern variogram to work,

[R] R Project for measurement of earnings management

2010-11-16 Thread Alireza Vafaei
Hello there, My name is Alireza. I am interested in utilizing R-program for measurement of earnings management (accounting related issue). However, there are two source programs which should be used simultaneously with the R-program to be able to measure earnings management. Previously (i.e. in

[R] Please, help me with 'mattern' variogram

2010-11-16 Thread Jimmy Martina
Hi, R-folks: I have been tryin many combination of parameter to make Matern variogram to work, but I can't find the available one. I'm near to be crazy. I tiped: Año2003Selg.lf<-likfit(Año2003Selg,cov.model="matern",ini.cov.pars=c(1.5,14),kappa=2.5,fix.kappa=FALSE,nugget=0.08,lambda=0.008,fix.l

Re: [R] Non-positive definite cross-covariance matrices

2010-11-16 Thread Peter Langfelder
> Peter, > > I see your point.  As it turns out though, what I'm trying to > calculate is heritability using a slightly modified version of an > equation from multivariate quantitative genetics.  Theoretically I > suppose a heritability matrix could be non-positive definite, but in > practice it al

Re: [R] Non-positive definite cross-covariance matrices

2010-11-16 Thread Jeff Bassett
On Tue, Nov 16, 2010 at 1:49 PM, Peter Langfelder wrote: > > It is easy to come up with examples where Cov(A, B) + Cov(B, A) is not > positive definite. As an extreme example, consider a matrix A (say 10 > columns, 100 rows) such that the off-diagonal covariances are all zero > and the columns are

Re: [R] Partition of a set

2010-11-16 Thread Michael Bedward
Hi Diana, Yes, this seems to be a little bug in the setparts function. The following is a modified version which should work for any x > 0. You'll see I've just changed a couple of lines... setparts2 <- function (x) { if (length(x) == 1) { if (x < 1) stop("if single value, x

Re: [R] DBLEPR?

2010-11-16 Thread Berwin A Turlach
G'day John, On Tue, 16 Nov 2010 14:02:57 -0500 "Prof. John C Nash" wrote: > Are the xxxPR routines now deprecated (particularly for 64 bit > systems) or still OK to use? They are still OK to use, and I use them occasionally. > If OK, can anyone point to documentation and examples? Section

Re: [R] Vectors out of lists?

2010-11-16 Thread Bill.Venables
Another approach would be > Y <- list(sqrt, sin, function(u) u/2) > Ybar <- function(u) rowMeans(sapply(Y, function(fun) fun(u))) > > integrate(Ybar, 0, 1) 0.4587882 with absolute error < 5.6e-05 > i.e. make the function vectorized directly. Note, however, that if you had Y[[4]] <- function(

Re: [R] Vectors out of lists?

2010-11-16 Thread Eduardo de Oliveira Horta
Thank you very much! Works like a charm! On Tue, Nov 16, 2010 at 10:24 PM, Phil Spector wrote: > Eduardo - > Thanks for the reproducible example! > >> Y<-list() >> Y[[1]]<-function(u) sqrt(u) >> Y[[2]]<-function(u) sin(u) >> Y[[3]]<-function(u) 1/2*u >> Ybar = function(u)mean(sapply(Y,function(

Re: [R] Vectors out of lists?

2010-11-16 Thread Phil Spector
Eduardo - Thanks for the reproducible example! Y<-list() Y[[1]]<-function(u) sqrt(u) Y[[2]]<-function(u) sin(u) Y[[3]]<-function(u) 1/2*u Ybar = function(u)mean(sapply(Y,function(fun)fun(u))) Since integrate requires a function which accepts a vector and returns a vector, we'd need to use Ve

[R] X11 module cannot be loaded

2010-11-16 Thread Changbin Du
HI, Dear R community, I have used the following codes this morning, but this afternoon, I got the following errors: > x <- seq(0,10, by=1) > y <- c(0.952, 0.947, 0.943, 0.941, 0.933, 0.932, 0.939, 0.932, 0.924, 0.918, 0.920) # missense > z <- c(0.068, 0.082, 0.080, 0.099, 0.108, 0.107, 0.101, 0.1

Re: [R] Vectors out of lists?

2010-11-16 Thread Eduardo de Oliveira Horta
Thanks, guys... but it seems these suggestions won't work. Let me try to be more specific with a simple example: Y<-list() Y[[1]]<-function(u) sqrt(u) Y[[2]]<-function(u) sin(u) Y[[3]]<-function(u) 1/2*u I wanted something equivalent to Ybar<-function(u){ 1/3*(Y[[1]](u) + Y[[2]](u) + Y[[3]](

[R] how exactly does 'identify' work?

2010-11-16 Thread casperyc
Hi all, # test=data.frame(x=1:26,y=-23.5+0.45*(1:26)+rnorm(26)) rownames(test)=LETTERS[1:26] attach(test) #test test.lm=lm(y~x) plot(test.lm,2) identify(test.lm$res,,row.names(test)) # not working plot(x,y) identify(x,y,row.names(test)) # works fine ident

Re: [R] Help fitting spatial glmm with correlated random effects

2010-11-16 Thread Ben Bolker
Elijah DePalma ucr.edu> writes: > > Greetings, > > May you please suggest a package or function to use for fitting a GLMM > (generalized linear mixed model) with spatially correlated random effects? > > Thank you, > Elijah DePalma Not easy, and I hope you have a lot of data. Your choices

Re: [R] Vectors out of lists?

2010-11-16 Thread David Winsemius
On Nov 16, 2010, at 6:18 PM, Phil Spector wrote: Eduardo - I'd guess that Ybar = function(u)mean(sapply(Y,function(fun)fun(u))) I had an example to which this was offered and all it did was make Ybar a function; # Polymorphic Fn-object Version 1 Fs <- list(mode="language") > Fs $mode [

[R] Bug in agrep computing edit distance?

2010-11-16 Thread Dickison, Daniel
The documentation for agrep says it uses the Levenshtein edit distance, but it seems to get this wrong in certain cases when there is a combination of deletions and substitutions. For example: > agrep("abcd", "abcxyz", max.distance=1) [1] 1 That should've been a no-match. The edit distance bet

Re: [R] plot linear model problem

2010-11-16 Thread casperyc
Thank you both. casper -- View this message in context: http://r.789695.n4.nabble.com/plot-linear-model-problem-tp3045763p3045932.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org mailing list https://stat.ethz.ch/

Re: [R] Counting

2010-11-16 Thread ufuk beyaztas
Thank you so much -- View this message in context: http://r.789695.n4.nabble.com/Counting-tp3045756p3045917.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help

Re: [R] Counting

2010-11-16 Thread ufuk beyaztas
Thank you so much -- View this message in context: http://r.789695.n4.nabble.com/Counting-tp3045756p3045918.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help

Re: [R] Breslow-Day test

2010-11-16 Thread Viechtbauer Wolfgang (STAT)
It's implemented in the metafor package. Using the example from the pdf that Marc pointed out: library(metafor) ai <- c(53, 121, 95, 103, 64, 7, 0) bi <- c(2, 3, 14, 27, 51, 29, 13) ci <- c(61, 152, 114, 66, 81, 28, 0) di <- c(1, 5, 7, 12

Re: [R] Vectors out of lists?

2010-11-16 Thread Phil Spector
Eduardo - I'd guess that Ybar = function(u)mean(sapply(Y,function(fun)fun(u))) will do what you want, but without a reproducible example, it's hard to tell. - Phil Spector Statistical Computing Facility

Re: [R] Playwith-problem with loading

2010-11-16 Thread jverzani
Fencl, Martin eawag.ch> writes: > > Helllo, > I am having trouble with running the library Playwith in the R-2.12.0. running under 32bit Windows XP. > After calling the library the error message "The procedure entry point gdk_cairo_reset_clip could not > be located in the dynamic library libgdk-

Re: [R] Vectors out of lists?

2010-11-16 Thread Henrique Dallazuanna
Try this: u <- 1:10 mean(sapply(Y, function(f)match.fun(f)(u))) On Tue, Nov 16, 2010 at 9:00 PM, Eduardo de Oliveira Horta < eduardo.oliveiraho...@gmail.com> wrote: > Hello there > > I have a list, Y, and each component of that list is a real-valued function > (that is, Y[[i]](u) returns a numbe

[R] Vectors out of lists?

2010-11-16 Thread Eduardo de Oliveira Horta
Hello there I have a list, Y, and each component of that list is a real-valued function (that is, Y[[i]](u) returns a number). I was wishing to build the mean function and the first thing I thought of was Ybar<-function(u){ mean(Y[[1:n]](u)) } but obviously this doesn't work, since Y[[1:n]]

Re: [R] Counting

2010-11-16 Thread Bill.Venables
Your outlier has row.names "1". If this is selected in the bootstrap sample once, it will also have row.names "1". If it is selected more than once the row.names of the successive entries will begin with "1." Here is a possibility you may wish to consider. > txt <- textConnection(" +

Re: [R] Cannot install packages in R 2.12.0 on Windows 7

2010-11-16 Thread Dick Beyer
Thanks very much for your help. This was a case of some weird network card IP reset hardware error that did something to permissions or something during the install. Not exactly sure if this was part of the problem. But getting the hardware corrected and reinstalling R 2.12.0 solved the prob

Re: [R] Counting

2010-11-16 Thread Phil Spector
First, I would rename your function "samples" to "mksample" to avoid confusion with the R function "sample". Next, I would modify the function so that you are returning a list of samples, instead of a list containing a list of samples: mksamples = function(data,num) lapply(1:num,f

Re: [R] Offset in glm poisson using R vs Exposure in Stata

2010-11-16 Thread Ben Bolker
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On 11/16/2010 03:08 PM, Columbine Caroline Waring wrote: > Officially I tried: **A** >> glm(count~md+ms+rf+sg+offset(log(Eff)), family=poisson,data=DepthHabGen) >> glm(count~md+ms+rf+sg, offset=(log(Eff)), family=poisson,data=DepthHabGen) > (which of

Re: [R] Counting

2010-11-16 Thread ufuk beyaztas
thank you very much for your idea, if i write code as; my data name is data. samples<-function(data,num){ resamples<-lapply(1:num,function(i) sample(data,n,replace=TRUE)) list(resamples=resamples)} >n=10 data<-rnorm(n=10,mean=5,sd=2) data[1]=100 obj<-samples(data,1000) i generate 1000 sample, i

[R] Population abundance, change point

2010-11-16 Thread Nicholas M. Caruso
I am trying to understand my population abundance data and am looking into analyses of change point to try and determine, at approximately what point do populations begin to change (either decline or increasing). Can anyone offer suggestions on ways to go about this? I have looked into bcp and st

[R] Fit a distribution to an "ECDF"

2010-11-16 Thread MyKenk
I have a growth curve, which is essentially an ECDF: Statistically, it's F(x)... > GrowthCurve [1] 0.06919932 0.24154761 0.42206402 0.61412408 0.72228295 0.79727292 0.86605315 0.91271120 0.98258397 1. I'd like to fit a Weibull Curve (then a LogLogistic) to this ECDF, and have no clue ho

Re: [R] Batch Processing Files

2010-11-16 Thread Nathan Miller
Dennis and all, Thank you for the help as I try to get this method for importing and batch processing files organized. I currently have this set-up to import data from two files in my working directory. "Var1" specifies data from file 1 and file 2. filenames=list.files() library(plyr) import

Re: [R] Question about GLMER

2010-11-16 Thread Daniel Jeske
Hi All - Doug, thanks for your reply. The context I'm looking at is a Poisson GLMM with random (intercept,slope) for each subject. The variance-covariance matrix is 2x2. By unstructured, I meant a 3 parameter matrix (sig1^2,sig2^2,sig12), as compared to a (reduced) alternative diagonal structur

Re: [R] discriminant function analysis

2010-11-16 Thread Chris Mcowen
Hi, I did this exact thing for my masters, with intertidal fish, I just used a PCA? have you tried that? Sent from my iPhone On 16 Nov 2010, at 17:01, Mike Gibson wrote: > > My objective is to look at differences in two species of fish from > morphometric measurements. My morphometric me

Re: [R] plot linear model problem

2010-11-16 Thread Andrew Miles
There may be an easier way to do this, but you could always just do it the long way. Ex. plot(residuals(test.lm)~fitted.values(test.lm)) Andrew Miles On Nov 16, 2010, at 5:01 PM, casperyc wrote: Hi all, Say I fit a linear model, and saved it as 'test.lm' Then if I use plot(test.lm) i

Re: [R] plot linear model problem

2010-11-16 Thread David Winsemius
On Nov 16, 2010, at 5:01 PM, casperyc wrote: Hi all, Say I fit a linear model, and saved it as 'test.lm' Then if I use plot(test.lm) it gives me 4 graphs How do I ask for a 'subset' of it?? ?plot.lm # The answer is in the first sentence. say just want the 1st graph, the residual vs

Re: [R] Counting

2010-11-16 Thread Andrew Miles
You could try something like this: Loop through your bootstrapped samples and store which ones have the outlier you are looking for using code like: count = c(count, outlier.value %in% boot.sample$outlier.variable) Then subtract the count variable from the total number of samples to get th

[R] plot linear model problem

2010-11-16 Thread casperyc
Hi all, Say I fit a linear model, and saved it as 'test.lm' Then if I use plot(test.lm) it gives me 4 graphs How do I ask for a 'subset' of it?? say just want the 1st graph, the residual vs fitted values, or the 1,3,4th graph? I think I can use plot(test.lm[c(1,3,4)]) before, but now, it's

[R] Counting

2010-11-16 Thread ufuk beyaztas
Hi dear all, i have a data (data.frame) which contain y and x coloumn(i.e. y x 1 0.58545723 0.15113102 2 0.02769361 -0.02172165 3 1.00927527 -1.80072610 4 0.56504053 -1.12236685 5 0.58332337 -1.24263981 6 -1.70257274 0.46238255 7 -0.88501561 0.89484429 8

Re: [R] hclust, does order of data matter?

2010-11-16 Thread Reshmi Chowdhury
I found the problem. For some reason, when I converted the list object with the data in it to numeric, the values changed. This resulted in different clustering results. Once that was fixed, the clustering was the same. Thanks for the responses! On Mon, Nov 15, 2010 at 2:37 PM, Peter Langfeld

Re: [R] How to pick out several infinite values when calculating means?

2010-11-16 Thread Joshua Wiley
Hi Lei, Here is one option relying on is.finite() ## Messy data for means dat <- data.frame(values = c(rnorm(7), 1:7, c(1, 2, 3, NA, 4, 5, 6), c(1, 2, Inf, 4, 100, -Inf, NaN)), group = rep(letters[1:4], 7)) ## use is.finite() to select for only finite numbers tapply(dat$values, dat$group, fun

[R] How to pick out several infinite values when calculating means?

2010-11-16 Thread Lei Zhou
Dear r-help, I want to use tapply to calculate means for a variable. But there were several infinite values in the observations. How can I calculate means not considering these infinite values? Thanks in advance. Regards, Lei [[alternative HTML version deleted]] __

Re: [R] Question about GLMER

2010-11-16 Thread Douglas Bates
I am cc:ing the r-sig-mixed-mod...@r-project.org mailing list on this reply as such questions are often answered more quickly on that list. On Tue, Nov 16, 2010 at 2:00 PM, Daniel Jeske wrote: > Dear R Help, > I believe the glmer() function in lme4 automatically fits an > unstrucruted covariance

Re: [R] odfWeave - "Format error discovered in the file in sub-document content.xml at 2, 4047 (row, col)"

2010-11-16 Thread Max Kuhn
Can you try it with version 7.16 on R-Forge? Use install.packages("odfWeave", repos="http://R-Forge.R-project.org";) to get it. Thanks, Max On Tue, Nov 16, 2010 at 8:26 AM, Søren Højsgaard wrote: > Dear Mike, > > Good point - thanks. The lines that caused the error mentioned above are > sim

Re: [R] How to Read a Large CSV into a Database with R

2010-11-16 Thread Abhijit Dasgupta
Thanks On 11/16/2010 12:41 PM, Seth Falcon wrote: > Hi Abhijit, > > [I've cc'd R-help to keep the discussion on the list] > > On Tue, Nov 16, 2010 at 8:06 AM, Abhijit Dasgupta > wrote: > >> Seth, >> >> I was looking for something like this too. I've a question. If >> you're reading the data f

Re: [R] Computing Rolling Average

2010-11-16 Thread William Dunlap
Have you tried filter()? filter(a, rep(1,7)/7) Bill Dunlap Spotfire, TIBCO Software wdunlap tibco.com > -Original Message- > From: r-help-boun...@r-project.org > [mailto:r-help-boun...@r-project.org] On Behalf Of Ray Brownrigg > Sent: Tuesday, November 16, 2010 12:05 PM > To: r-help

Re: [R] Computing Rolling Average

2010-11-16 Thread Paolo Rossi
Definitely out of sequence - it should be [,1] [,2] [1,]4 21 [2,]5 22 [3,]6 23 [4,]7 24 [5,]8 25 [6,]9 26 [7,] 10 27 [8,] 11 28 [9,] 12 29 [10,] 13 30 [11,] 14 31 On 16 November 2010 20:12, David Winsemius wrote: > > On No

[R] Question about GLMER

2010-11-16 Thread Daniel Jeske
Dear R Help, I believe the glmer() function in lme4 automatically fits an unstrucruted covariance matirx for the random effects. Is that true?If so, do I have an option to somehow ask for a diagonal structured covariance matrix? Thank you, Daniel Jeske Department of Statistics University of

Re: [R] Computing Rolling Average

2010-11-16 Thread David Winsemius
On Nov 16, 2010, at 2:33 PM, Paolo Rossi wrote: Hi, Can anyone suggest a clever way to compute a rolling weekly average of the columns in a matrix? The column bit is straightforward – use apply given a function which does what you want on a column. With regard to a particular column, th

Re: [R] format secondary axis for dates

2010-11-16 Thread David Winsemius
On Nov 16, 2010, at 2:32 PM, Jannis wrote: Dear List, this may be a Newbi question and may have been asked several times, but i am too stupid to find the posts. I have a plot of values against POSIXct time steps. If I want to add a second x axis to the top margin of the plot, only numb

Re: [R] Offset in glm poisson using R vs Exposure in Stata

2010-11-16 Thread Columbine Caroline Waring
Ben, Thank you, it WAS a typo of sorts. Officially I tried: > glm(count~md+ms+rf+sg+offset(log(Eff)),family=poisson,data=DepthHabGen) > glm(count~md+ms+rf+sg, offset=(log(Eff)),family=poisson,data=DepthHabGen) (which of course are the same as eachother) > glm(count~md+ms+rf+sg, offset=(

Re: [R] Computing Rolling Average

2010-11-16 Thread Ray Brownrigg
On Wed, 17 Nov 2010, Paolo Rossi wrote: > Hi, > Can anyone suggest a clever way to compute a rolling weekly average of the > columns in a matrix? The column bit is straightforward – use apply given a > function which does what you want on a column. With regard to a particular > column, the obviou

Re: [R] Re : interpretation of coefficients in survreg AND obtaining the hazard function for an individual given a set of predictors

2010-11-16 Thread Thomas Lumley
A coefficient of -0.4 means that survival times are multiplied by exp(-0.4), that is, people survival only 67% as long. -thomas On Wed, Nov 17, 2010 at 4:32 AM, Vincent Vinh-Hung wrote: > Thanks for sharing the questions and responses! > > Is it possible to appreciate how much the coefficie

[R] Help fitting spatial glmm with correlated random effects

2010-11-16 Thread Elijah DePalma
Greetings, May you please suggest a package or function to use for fitting a GLMM (generalized linear mixed model) with spatially correlated random effects? Thank you, Elijah DePalma [[alternative HTML version deleted]] __ R-help@r-project.org

[R] Sweave: \Sexpr and variables with special chars

2010-11-16 Thread Ralf B
I am using \Sexpr to include a variable in a title of a Sweave document: \documentclass[a4paper]{article} <>= #mytitlevar <- "Stuff" # case 1, everything is find mytitlevar <- "Stuff_first" # case 2, f is turned into sub-text @ \title{MyTitle: \\ \Sexpr{mytitlevar} } \begin{document} \maketitle \e

Re: [R] help using function merge_all()

2010-11-16 Thread arjun
Hi Josh, I thought of giving up and started writing code in excel using VBA but then I saw ur message and gave a try in R. I got it, the location from which I am calling the package "plyr" is not working out so called from different CRANmirror location and then I was able load the pac

Re: [R] Extending a plot in a loop (With attachment)

2010-11-16 Thread Peter Alspach
Tena koe Nasrin Try points() instead of plot() in your second and subsequent calls to plot(). points() and lines() adds to the current plot by default. Of course you may have difficulties with setting the x and y limits by that's another matter. HTH Peter Alspach > -Original Messag

Re: [R] Anyone can help with this question

2010-11-16 Thread Jonathan P Daily
assuming your data takes the form of locationlatitudelongitude string num num string2 num num try: sub <- dat[sample.int(length(dat$location), 1000),] -- Jonathan P. Daily Technician - USGS Leetown Science Center 11649 Leetown Road Kea

Re: [R] help using function merge_all()

2010-11-16 Thread arjun
Hi Josh, Thanks for your reply. While I am loading the package, it says package plyr is required and I tried to install plyr package but I am unable to do so because it is giving an error message as shown below. Please help me. library(reshape) Loading required pa

Re: [R] Anyone can help with this question

2010-11-16 Thread Henrique Dallazuanna
Try this: DF[sample(seq(nrow(DF)), 1000),] Where DF is your data On Tue, Nov 16, 2010 at 3:13 PM, Mariana wrote: > > Hi there: > I am a total beginner in R, and I have a simple question: > I have a table with thousands of lines that represent locations, and two > columns: latitude and longitud

[R] Computing Rolling Average

2010-11-16 Thread Paolo Rossi
Hi, Can anyone suggest a clever way to compute a rolling weekly average of the columns in a matrix? The column bit is straightforward – use apply given a function which does what you want on a column. With regard to a particular column, the obvious way is to run a for loop indexing the last 7 day

Re: [R] Pass character vector to function argument

2010-11-16 Thread Kevin Ummel
On second glance, while it works for 'stack', it doesn't appear to work for 'overlay': > overlay(sapply(obs,get)) Error in function (classes, fdef, mtable) : unable to find an inherited method for function "overlay", for signature "list", "missing" At this point, this may be more of a 'rast

Re: [R] Pass character vector to function argument

2010-11-16 Thread Henrique Dallazuanna
Using David's examples: do.call(stack, lapply(obs, get)) On Tue, Nov 16, 2010 at 4:04 PM, Kevin Ummel wrote: > Sorry, I shouldn't have used 'sum' as an example; I am looking for a > solution in the case of functions that do not result in simple vectors or > matrices. > > The "real-world" examp

[R] format secondary axis for dates

2010-11-16 Thread Jannis
Dear List, this may be a Newbi question and may have been asked several times, but i am too stupid to find the posts. I have a plot of values against POSIXct time steps. If I want to add a second x axis to the top margin of the plot, only numbers are at the tickmarks. Is there a straightforw

Re: [R] Pass character vector to function argument

2010-11-16 Thread Kevin Ummel
Thanks, David. That does, indeed, work. It didn't occur to me that a list would do the job as an argument. Thanks for the fix! kevin On Nov 16, 2010, at 6:58 PM, David Winsemius wrote: > > On Nov 16, 2010, at 1:04 PM, Kevin Ummel wrote: > >> Sorry, I shouldn't have used 'sum' as an example;

Re: [R] Anyone can help with this question

2010-11-16 Thread David Winsemius
On Nov 16, 2010, at 12:13 PM, Mariana wrote: Hi there: I am a total beginner in R, Time to read the Posting Guide. (Especially since Nabble appears to deficient in providing an introductory document, at least judging from the email behavior of some of its users.) and I have a simple q

[R] Playwith-problem with loading

2010-11-16 Thread Fencl, Martin
Helllo, I am having trouble with running the library Playwith in the R-2.12.0. running under 32bit Windows XP. After calling the library the error message "The procedure entry point gdk_cairo_reset_clip could not be located in the dynamic library libgdk-win32-2.0-0.dll." occurs and the R asks fo

Re: [R] Odp: Sampling problem

2010-11-16 Thread wangwallace
Fabulicious! It worked!!! One more question, in the following data frame as posted above: SubIDCSE1 CSE2 CSE3 CSE4 WSE1 WSE2 WSE3 WSE4 1 6 5 6 2 6 22 4 2 6 4 7 2 6 6

[R] discriminant function analysis

2010-11-16 Thread Mike Gibson
My objective is to look at differences in two species of fish from morphometric measurements. My morphometric measurements are head length, eye diameter, snout length, and measurements from tail to each fin. I want to use discrimanant function analyis to determine if there are differences betw

[R] Anyone can help with this question

2010-11-16 Thread Mariana
Hi there: I am a total beginner in R, and I have a simple question: I have a table with thousands of lines that represent locations, and two columns: latitude and longitude. I need to randomly sample 1000 lines. How do I do it? I know the command "sample", but it samples elements independently, no

Re: [R] Pass character vector to function argument

2010-11-16 Thread Kevin Ummel
Sorry, I shouldn't have used 'sum' as an example; I am looking for a solution in the case of functions that do not result in simple vectors or matrices. The "real-world" example is something like the following using the 'raster' package, though (I think) any command producing an S4 object could

[R] Extending a plot in a loop (With attachment)

2010-11-16 Thread Nasrin Pak
My problem is that I have a data set for every day of measurement in a seperate file and I want to plot one parameter of the data for all the days in one graph. I tried to use for loop but only the last data remains in the program memory, I don`t know how to plot each day`s data continusly after th

Re: [R] Error: invalid type(list) for variable when using lm()

2010-11-16 Thread Phil Spector
Tianchan - Your X is not a matrix -- it's a dataframe. Probably the simplest solution is to use lm(y~as.matrix(X)) but you should also learn the difference between a data frame and a matrix. - Phil Spector

Re: [R] Error: invalid type(list) for variable when using lm()

2010-11-16 Thread Henrique Dallazuanna
Try this: y <- rnorm(100) X <- matrix(runif(100 * 10), ncol = 10) lm(y ~ ., data = cbind.data.frame(y, X)) On Tue, Nov 16, 2010 at 5:07 PM, Tianchan Niu wrote: > Dear All,I would like to do multiple regression in R. I used: lm(y~X), > where y is a n by 1 vector, and X is a n by m matrix. I kep

[R] DBLEPR?

2010-11-16 Thread Prof. John C Nash
Ravi Varadhan and I have been looking at UCMINF to try to identify why it gives occasional (but not reproducible) errors, seemingly on Windows only. There is some suspicion that its use of DBLEPR for finessing the Fortran WRITE() statements may be to blame. While I can find DBLEPR in Venables an

[R] Error: invalid type(list) for variable when using lm()

2010-11-16 Thread Tianchan Niu
Dear All,I would like to do multiple regression in R. I used: lm(y~X), where y is a n by 1 vector, and X is a n by m matrix. I kept getting the error message:Error in model.frame.default(formula = y ~ X,  :  invalid type (list) for variable 'X'. However, when I used: lm(y~X[,1]+X[,2]+X[,3]+…+X[,m]

Re: [R] Pass character vector to function argument

2010-11-16 Thread David Winsemius
On Nov 16, 2010, at 1:04 PM, Kevin Ummel wrote: Sorry, I shouldn't have used 'sum' as an example; I am looking for a solution in the case of functions that do not result in simple vectors or matrices. The "real-world" example is something like the following using the 'raster' package, th

Re: [R] Please help me on a simple avg question

2010-11-16 Thread Henrique Dallazuanna
Try this: aggregate(TEMP ~ Year + Month + Day, DF, mean) On Tue, Nov 16, 2010 at 4:48 PM, facehappywy wrote: > > Thanks every one first. > > I have a dataset like this > > YearMonth Day HourDIR SPD (m/s) SKYCOVER > TEMP (C)RH(%) > 20091 1 0

Re: [R] Non-positive definite cross-covariance matrices

2010-11-16 Thread Peter Langfelder
On Tue, Nov 16, 2010 at 9:40 AM, Jeff Bassett wrote: > Giovanni, > > Both matrices describing the points (A and B in my example) are the > same size, so the resulting matrix will always be square.  Also, the > equation I'm using is essentially the following identity: > > Var(A + B) = Var(A) + Var(

[R] Please help me on a simple avg question

2010-11-16 Thread facehappywy
Thanks every one first. I have a dataset like this YearMonth Day HourDIR SPD (m/s) SKYCOVERTEMP (C)RH(%) 20091 1 0 310 13.858243 -5 23 20091 1 1 330 14.305283 -7.

Re: [R] help using function merge_all()

2010-11-16 Thread Joshua Wiley
Hi, Did you also load the package (you'll need to load it every session you want to use it)? ## load reshape package library(reshape) ## now try merge_all(Br, Ki, Lu, Pr, by="Genes") If this does not resolve your problem, please run: sessionInfo() at your console and report the output (it wil

Re: [R] rotate column names in large matrix

2010-11-16 Thread Chris Stubben
Just increase the margins on the left side and add the rownames x <- cor(matrix(rnorm(600), 60, 100)) rownames(x)<-paste("row", 1:100) op<-par(mar=c(1,5,1,1), xpd=TRUE) image(t(x[nrow(x):1,]), axes=FALSE) text(-0.01, seq(0,1,length=nrow(x) ), rownames(x), pos = 2, offset = 0, cex = .7) Another

Re: [R] Simple error handling in R

2010-11-16 Thread Gabor Grothendieck
On Tue, Nov 16, 2010 at 10:58 AM, Aleksey Naumov wrote: > Hi R experts, > > I am looking for a simple error handling approach, whereby I could stop > function execution with a customized error message. For example: > > for (i in 1:10) { >   if (i == 5) >      # I'd like to be able to stop right he

Re: [R] glmer, Error: Downdated X'X is not positive definite,49

2010-11-16 Thread Douglas Bates
It is often more effective to send questions about lmer or glmer to the r-sig-mixed-mod...@r-project.org mailing list, which I am cc:ing on this response. On Tue, Nov 16, 2010 at 3:25 AM, Annika wrote: > > Dear list, > > I am new to this list and I am new to the world of R. Additionally I am not

  1   2   >