Re: [R] question about cbind()

2006-08-20 Thread Prof Brian Ripley
On Sat, 19 Aug 2006, [EMAIL PROTECTED] wrote: Dear all, I have a question about how to get a matrix by combining a large number of columns from a data file. Suppose I read a file which have 1000 columns by: test = read.table(dat.txt, header=F) I know I could use cbind(). It's easy to

Re: [R] issues with Sweave and inclusion of graphics in a document

2006-08-20 Thread Prof Brian Ripley
savePlot is just an internal version of dev.copy, part of the support for the menus on the windows() graphics device. It is described in `An Introduction to R' (the most basic R manual). On Sat, 19 Aug 2006, Thomas Harte wrote: the problem is a little hard to explain; the .Rnw files (below)

Re: [R] fMultivar OLS - how to do dynamic regression?

2006-08-20 Thread Spencer Graves
The documentation for 'OLS' says that it is a wrapper for 'lm'; if you type 'OLS' at a command prompt, you will see that it does little more than calling 'lm' and returning the output. An example of 'dynamic regression' appears in the example section of the help page for 'arima'.

[R] how to the p-values or t-values from the lm's results

2006-08-20 Thread zhijie zhang
Dear friends, After running the lm() model, we can get summary resluts like the following: Coefficients: Estimate Std. Error t value Pr(|t|) x1 0.115620.10994 1.052 0.2957 x2 -0.138790.09674 -1.435 0.1548 x3 0.010510.09862 0.107 0.9153 x4 0.141830.08471 1.674

Re: [R] how to the p-values or t-values from the lm's results

2006-08-20 Thread Sean O'Riordain
Hi there Zhang, While there might be a better way... an ugly but generic way of accessing this type of information is to use str() and a little experimentation... here is a little history() of what I did to find it... a str(a) str(logr) a[[1]] a[[2]] a[[3]] a[[4]] a[[4]][[1]] a[[4]][1,]

Re: [R] Query: how to modify the plot of acf

2006-08-20 Thread Andrew Robinson
Try constructing the acf plot using the traditional plot tools. Then you can do what you like with it. Eg if your model is called model.lme, then something like this should work: acf.resid - ACF(model.lme, resType = n) my.lags - acf.resid$lag 0.5 plot(acf.resid$lag[my.lags],

Re: [R] how to the p-values or t-values from the lm's results

2006-08-20 Thread Dimitrios Rizopoulos
try the following: data - data.frame(matrix(rnorm(900), ncol = 9)) names(data) - c(y, paste(x, 1:8, sep = )) logr - lm(y ~ . - 1, data) a - summary(logr) coef(a) coef(a)[, 3:4] coef(a)[, t value] coef(a)[, Pr(|t|)] I hope it helps. Best, Dimitris Dimitris Rizopoulos Ph.D. Student

[R] unquoting

2006-08-20 Thread Murray Jorgensen
I would like a function to strip quotes off character strings. I should work like this: A - matrix(1:6, nrow = 2, ncol=3) AF - as.data.frame(A) names(AF) - c(First,Second,Third) AF First Second Third 1 1 3 5 2 2 4 6 names(AF)[2] [1] Second attach(AF)

Re: [R] unquoting

2006-08-20 Thread Gabor Grothendieck
Try these get(names(AF)[2]) AF[Second] # this one different than the rest AF[[Second]] AF[, Second] AF$Second On 8/20/06, Murray Jorgensen [EMAIL PROTECTED] wrote: I would like a function to strip quotes off character strings. I should work like this: A - matrix(1:6, nrow =

Re: [R] unquoting

2006-08-20 Thread Peter Dalgaard
Murray Jorgensen [EMAIL PROTECTED] writes: I would like a function to strip quotes off character strings. I should work like this: A - matrix(1:6, nrow = 2, ncol=3) AF - as.data.frame(A) names(AF) - c(First,Second,Third) AF First Second Third 1 1 3 5 2 2

Re: [R] unquoting

2006-08-20 Thread Prof Brian Ripley
?get I really think this has nothing to do with `quoting', rather to do with evaluating variables from their names. At first I though you were looking for noquote(), which does unquote in the conventional sense. noquote(names(AF)[2]) [1] Second get(names(AF)[2]) [1] 3 4 On Sun, 20 Aug 2006,

Re: [R] Variance Components in R

2006-08-20 Thread Iuri Gavronski
Reading Bates' article on R News, I see that random effects require a grouping variable. As, by convention, all variables in G-studies are supposed random, what could be a grouping variable in that case? I see that the model I wrote before (if ever ran...) would take all effects as fixed. Is it

[R] Grid Points

2006-08-20 Thread Anupam Tyagi
How do I put grid points (not grid lines) as the base layer of an xyplot? Is there a way to vary the interval at which x and y grid points are placed? Is it possible to start a graph so that Y axis begins at 500 and ends at 800? I am only interested in focusing on the relative distance between

Re: [R] Variance Components in R

2006-08-20 Thread Iuri Gavronski
Harold, I have tried to adapt your syntax and got some problems. Some responses from lmer: On this one, I have tried to use 1 as a grouping variable. As I understood from Bates (2005), grouping variables are like nested design, which is not the case. fm - lmer(RATING ~ CHAIN*SECTOR*RESP

Re: [R] split a y-axis to show data on different scales

2006-08-20 Thread Anupam Tyagi
I think information can be enhanced by using different scaled graphs next to each other. mfrow() created too much space, there may be no need to again draw the x-axis. It can be very useful to have different scales of the same data presented next to each other, in addition to the main graph. So I

Re: [R] Variance Components in R

2006-08-20 Thread Iuri Gavronski
Harold, I have tried the following syntax: fm - lmer(RATING ~ CHAIN*SECTOR*RESP +(1|CHAIN*SECTOR*RESP), gt) summary(fm) Linear mixed-effects model fit by REML Formula: RATING ~ CHAIN * SECTOR * RESP + (1 | CHAIN * SECTOR * RESP) Data: gt AIC BIClogLik MLdeviance REMLdeviance

Re: [R] Grid Points

2006-08-20 Thread Gabor Grothendieck
Try this. gl(2,50) is such that the first 50 points are series 1 and the second 50 points are series 2. The scales= argument defines the positions of the tick marks and the xlim= argument defines the x axis limits. The layout puts the panels on top of each other rather than side by side. strip

Re: [R] split a y-axis to show data on different scales

2006-08-20 Thread Gabor Grothendieck
Look at oma= and mar= parameters to par for controlling the space when using mfrow=. e.g. opar - par(oma = c(6, 0, 5, 0), mar = c(0, 5.1, 0, 2.1), mfrow = c(2,2)) for(i in 1:4) plot(1:10) par(opar) On 8/20/06, Anupam Tyagi [EMAIL PROTECTED] wrote: I think information can be enhanced by using

[R] fit the series data

2006-08-20 Thread zhijie zhang
Dear friends, suppose my dataset *xy* : xy 1 5 2 3 5 6 6 8 -generated the data-- x-c(1,2,5,6) y-c(5,3,6,8) xy-data.frame(x,y) --- I want to fit the gap in x with the corresponding y=0, I use the following programs to generate a

Re: [R] string-to-number

2006-08-20 Thread Marc Schwartz
On Sat, 2006-08-19 at 10:25 -0600, Mike Nielsen wrote: Wow. New respect for parse/eval. Do you think this is a special case of a more general principle? I suppose the cost is memory, but from time to time a speedup like this would be very beneficial. Any hints about how R programmers

Re: [R] fit the series data

2006-08-20 Thread jim holtman
try this: x-c(1,2,5,6) y-c(5,3,6,8) xy-data.frame(x,y) xy x y 1 1 5 2 2 3 3 5 6 4 6 8 new.df - data.frame(x=seq(max(xy$x)), y=rep(0, max(xy$x))) new.df x y 1 1 0 2 2 0 3 3 0 4 4 0 5 5 0 6 6 0 new.df$y[xy$x] - xy$y new.df x y 1 1 5 2 2 3 3 3 0 4 4 0 5 5 6 6 6 8 On 8/20/06, zhijie

Re: [R] Grid Points

2006-08-20 Thread Anupam Tyagi
Thanks. How do I retain the same scale of grid.points from one panel to next even if the scale of the data changes? For example: c(seq(601:700),seq(6510,7000, by=10)) ~ seq(601:700) | gl(2,50). --- Gabor Grothendieck [EMAIL PROTECTED] wrote: Try this. gl(2,50) is such that the first 50

Re: [R] Simulate p-value in lme4

2006-08-20 Thread Spencer Graves
You've raised a very interesting question about testing a fixed-effect factor with more than 2 levels using Monte Carlo. Like you, I don't know how to use 'mcmcsamp' to refine the naive approximation. If we are lucky, someone else might comment on this for us. Beyond this, you

[R] C compile problem on Ubuntu linux

2006-08-20 Thread Frank E Harrell Jr
Under Ubuntu dapper, after installing packages gcc and g77, under platform i486-pc-linux-gnu arch i486 os linux-gnu system i486, linux-gnu status major2 minor2.1 year 2005 month12 day 20 svn rev 36812 language R I get an error when trying to

Re: [R] C compile problem on Ubuntu linux

2006-08-20 Thread Frank E Harrell Jr
Manuel Castejón Limas wrote: Hello, I've just compiled Hmisc ok under dapper. I think you need to further install some packages. Have you installed libc6-dev? I would start installing the build-essential package. Best wishes Manuel Thanks Manuel, apt-get install build-essential solved the

[R] plot problem

2006-08-20 Thread Daniil Ivanov
Hello. I'm pretty much new to R and I'm trying to produce some figures. It seems to me, that R has some asynchronous way of plotting figures. When I run this code: #constructs the semivariogram of SC1929 vgm1 - variogram(SC1929~1,~U+V,puerto.map$att.data) # trying to make new plot

Re: [R] plot problem

2006-08-20 Thread Prof Brian Ripley
On Sun, 20 Aug 2006, Daniil Ivanov wrote: Hello. I'm pretty much new to R and I'm trying to produce some figures. What have you been reading to get the ideas below? People new to R do not tend to use dev.next ... indeed experienced users very rarely use it. It seems to me, that R has

Re: [R] unquoting

2006-08-20 Thread Murray Jorgensen
Thank you, Brian, Peter and Gabor Brian has what want. My heading was a bit misleading. I was looking for a function that would, in logicians' terms, convert 'mention' into 'use'. (This usually goes along with the story about the importance of knowing the difference between a lion and lion.)

Re: [R] plot problem

2006-08-20 Thread Daniil Ivanov
Hi, Ok, thanks to all. Problem was with class of variogram class(vgm1) [1] gstatVariogram data.frame If I fix it manually to class(vgm1) - gstatVariogram everything runs as it should. Thanks, Daniil. On 8/21/06, Prof Brian Ripley [EMAIL PROTECTED] wrote: On Sun, 20 Aug 2006, Daniil Ivanov

Re: [R] Variance Components in R

2006-08-20 Thread Iuri Gavronski
Dear Harold and others, I have changed the syntax for lmer() and used this one: require(lme4) gt - read.table(gt5.txt) sink(GT output.txt) attach(gt) system.time(fm - lmer(RATING ~ 1 +(1|CHAIN) +(1|SECTOR) +(1|RESP) +(1|ASPECT) +(1|ITEM) +(1|SECTOR*RESP) +(1|SECTOR*ASPECT) +(1|SECTOR*ITEM)

Re: [R] plot problem

2006-08-20 Thread Daniil Ivanov
Ok, what is wrong with a following code: # remove all the present objects rm(list = ls()) # load the libraries we need library(gstat) data(meuse) vgm1 - variogram(log(zinc)~1, ~x+y, meuse) plot(vgm1) dev.copy2eps(file=fig2.eps,horizontal=T) dev.off() it plots nothing but from the R console

Re: [R] Permutations with replacement

2006-08-20 Thread Jesse Albert Canchola
Thanks, David. That worked fabulously! Here is the R code for the hypercube test example: ## begin R code library(combinat) x - rep(3,3) # for partitions of 3 units into the three classes {1,2,3} hcube(x, scale=1, transl=0) ### end R code For

Re: [R] Grid Points

2006-08-20 Thread Gabor Grothendieck
That's the default. See the relation subargument to scales if you want them different. e.g. library(lattice) y - c(601:700, seq(6510,7000, by=10)) x - c(601:700, 601:650) g - rep(1:2, c(100, 50)) xyplot(y ~ x | g) On 8/20/06, Anupam Tyagi [EMAIL PROTECTED] wrote: Thanks. How do I retain the