[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 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

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] 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] 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] 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

[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] 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

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

[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

[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

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

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] 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] 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] 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] 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

[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

[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

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

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 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] 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 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(" +

[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] 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

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 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] 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] 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] 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] 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/

[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] 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 [

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

[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] 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] 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 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

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 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] 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] 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] 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] 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

[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

[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

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,

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

[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.

[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

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] 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] 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] 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] 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

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] 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] 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 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] 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] 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] 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] 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

<    1   2