[R] using xval in mvpart to specify cross validation groups

2010-03-12 Thread Andrew Dolman
Dear R's I'm trying to use specific rather than random cross-validation groups in mvpart. The man page says: xval Number of cross-validations or vector defining cross-validation groups. And I found this reply to the list by Terry Therneau from 2006 The rpart function allows one to give the cro

Re: [R] using xval in mvpart to specify cross validation groups

2010-03-12 Thread Andrew Dolman
s <- rep(1:3, each=(length(y)/3)) dat <- data.frame(x,y1,s) xyplot(y1~x|s, data=dat) (mvpart(y1~x, data=dat, xv="1se", xval=s)) Thank you for your help. andydol...@gmail.com On 12 March 2010 18:03, Dennis Murphy wrote: > Hi: > > See inline... > > On Fr

Re: [R] Uncorrelated random vectors

2009-07-07 Thread Andrew Dolman
You could use the mvtnorm package to generate correlated vectors of random normal deviates where the nominal correlation is 0. library(mvtnorm) rho <- 0.0 Cor <- array(c(1, rho, rho, 1), dim=c(2,2)) Y <- rmvnorm(1000, sigma=Cor) plot(Y) cor(Y) cor.test(Y[,1],Y[,2]) Any given random set will hav

Re: [R] Error in library(gplots) : there is no package called 'gplots'

2010-03-25 Thread Andrew Dolman
Do you mean installing packages as in install.packages("gplots") ? for which you need an internet connection. or attaching packages that are already installed, when you want to use them library(gplots) Or are you trying to install from source code or from downloaded zip packages? andydo

Re: [R] Error in library(gplots) : there is no package called 'gplots'

2010-03-27 Thread Andrew Dolman
our interesrt. > > yes I mean for instance install.packages("gplots_2.7.4.tar.gz", repos=NULL, > type="source") > with the correct path to the package location of course > > Valère > > [Martin Valere] -Ursprüngliche Nachricht- > Von: Andrew Do

Re: [R] Creating two lines of best fit on a scatter plot

2010-04-07 Thread Andrew Dolman
lm1 <- lm(y~x, data=mydata, subset=mydata$patchchoice==1) lm2 <- lm(y~x, data=mydata, subset=mydata$patchchoice==2) abline(lm1, col="Blue") abline(lm2, col="Red" ) Should do it. Not likely the best way but a way. Andy. andydol...@gmail.com On 7 April 2010 19:17, Samantha Reynolds wrote:

Re: [R] Concatenating two vectors into one

2009-05-18 Thread Andrew Dolman
x<-as.character(c("A","B","C","D","E","F")) y<-as.factor(c("1","2","3","4","5","6")) ?paste paste(x,y, sep="") andydol...@gmail.com 2009/5/18 Henning Wildhagen > Dear users, > > a very simple question: > > Given two vectors x and y > > x<-as.character(c("A","B","C","D","E","F")) > y<-as.

Re: [R] How to write a loop?

2009-05-27 Thread Andrew Dolman
Try lapply(ONS, fft) and take a look here http://cran.r-project.org/doc/manuals/R-intro.html for the basics of data structures in R and how to apply functions to them. Andy. andydol...@gmail.com 2009/5/27 Linlin Yan > Why did you use different variable names rather than index of > list/d

Re: [R] RES: Most used R editors

2009-06-02 Thread Andrew Dolman
For Windows I've been using Notepad++ with npptor http://sourceforge.net/projects/npptor/ Simple and lightweight. Syntax highlighting, code folding and code passing are all I want. andydol...@gmail.com 2009/6/2 Rodrigo Aluizio > Well, on windows an excellent and free software for R scr

[R] Odp: Plot and lm

2009-06-05 Thread Andrew Dolman
A mix of Petr and William's answers will sort you out. You had two problems: the base 10/e problem and the axes swapping problem. ?dput I didn't know about that one either - very useful! andydol...@gmail.com 2009/6/5 Petr PIKAL Hi > > r-help-boun...@r-project.org napsal dne 04.06.2009 16:1

Re: [R] filtering number of values in a data frame

2009-06-18 Thread Andrew Dolman
Take a look at the function ?aggregate andydol...@gmail.com 2009/6/18 René Schönemann > Dear list, > > given is the following data frame df(): > >Number Place Start End > 1 218024740787 HHO 5 263 2008-01-02 00:21:14 2008-01-03 15:25:16

Re: [R] A way to get the R data stored temporarily in working memory?

2009-04-27 Thread Andrew Dolman
Using write() with append=T should work. Just be careful not to open the text file with a program that will lock it while the loop is still running. Text editors will not usually lock the file so in windows you could use notepad to take a look at the output and copy/paste to somewhere else. e.g.

Re: [R] problem with symbol function

2009-04-27 Thread Andrew Dolman
I just tested this on my windows setup and you're right - it appears to draw 2 solid circles and if you save as .png or .jpeg that's what you get in the resultant file - but if you save as .ps or .pdf you get a dashed outer circle. I don't know why. Andy. R 2.8.1 andydol...@gmail.com 2009/4

Re: [R] creating a vector of sums

2009-04-28 Thread Andrew Dolman
Look at ?cumsum andydol...@gmail.com 2009/4/28 Rachel Taylor > > Hi, > > I am trying to create a function for a goodness-of-fit test for the Pareto > Distribution for some loss data that I have. > So far I have the following: > > function(X=OTOL) > { > n <- length(X)-1 #calculated the number

Re: [R] Kolmogorov-Smirnov test

2009-04-29 Thread Andrew Dolman
help.search("kolmogorov") ?ks.test andydol...@gmail.com 2009/4/29 mathallan > > I got a distribution function and a empirical distribution function. How do > I > make to Kolmogorov-Smirnov test in R. > > Lets call the empirical distribution function >Fn on [0,1] > and the

Re: [R] 2 way ANOVA with possible pseudoreplication

2009-04-29 Thread Andrew Dolman
Hi Natalie, It sounds like a mixed model might be appropriate but it's not completely clear what your data are like. How many levels are there of each factor? Or is each factor just binary (treatment or no treatment)? What did you measure as the response? It's a good idea to post a sample of your

[R] Fwd: 2 way ANOVA with possible pseudoreplication

2009-05-01 Thread Andrew Dolman
sible pseudoreplication To: Andrew Dolman Hi Andy, Thanks ever so much for your reply. I have attached the general layout of my data with some more infomation on how it was collected. If you have any ideas they would be much appreciated. Many thanks, Natalie So I’ve measured muscle power output (conti

Re: [R] sum in vector

2010-11-14 Thread Andrew Dolman
tapply(price, market, sum) andydol...@gmail.com On 14 November 2010 13:02, lgpeco wrote: > > hy guys i have one question :) > > i have two vectors markets and price > > market <- c(1, 5, 7, 9, 9, 6, 5, 4, 4, 3, 1, 2, 1) > price <- c(100, 20, 30, 10, 50, 23, 23, 33, 96, 6, 4, 38, 96) > i would

[R] multcomp and lme4

2007-10-07 Thread Andrew Dolman
Dear list members, Can anyone please point to an example of how to use glht(multcomp) with lmer objects? I am trying: summary(glht(lmerObject, linfct = mcp(x = "Tukey"))) as I would for a glm object, but with no luck. Thank you, Andy. [[alternative HTML version deleted]] __