Re: [R] Type II and III sum of square in Anova (R, car package)

2006-08-26 Thread Mark Lyman
> 1. First of all, more general question. Standard anova() function for lm() > or aov() models in R implements Type I sum of squares (sequential), which > is not well suited for unbalanced ANOVA. Therefore it is better to use > Anova() function from car package, which was programmed by John Fox to

Re: [R] Simulations in R during power failure

2006-08-26 Thread mel
[EMAIL PROTECTED] a écrit : > Hi everyone, > I recently ran a simulation on a computer using R that was hooked up to a > UPS. There was one time when the power was out for length and the computer > shut down. I was worried that I had lost the simulation, but upon booting > the machine up, I h

Re: [R] Permanently changing gui preferences

2006-08-26 Thread mel
David Kaplan a écrit : > Greetings, > I made changes to my gui preferences and saved them. When I close and > then open R, it reverts back to default preferences. How do I > permanently change gui preferences? one way is using options() and also using your Rprofile.site file (in ~/etc). edit

Re: [R] Modifying the embed-results

2006-08-26 Thread Atte Tenkanen
Thanks! I see, that do.call-function is used often in R-algorithms... Looking over some extra do.call-examples seems useful. This tail-function is also new for me. Is there some reason to use seq(along = VECTOR) instead of 1:length(VECTOR)? Atte > You can replace the for with lapply like thi

[R] Students With Writing Difficulties?

2006-08-26 Thread [Academics] Discourse Consultants
If you have undergraduates who have trouble writing a decent term paper, or postgraduates who are having problems with their theses or publications, we may be able to help you. We offer a personalised, online, tuition service designed to help students and academics produce solid, well argued tex

[R] Simulations in R during power failure

2006-08-26 Thread bbvaughn
Hi everyone, I recently ran a simulation on a computer using R that was hooked up to a UPS. There was one time when the power was out for length and the computer shut down. I was worried that I had lost the simulation, but upon booting the machine up, I heard the processor kick in. It sounde

Re: [R] how to create many objects with sequencial names?

2006-08-26 Thread Wensui Liu
Hi, Jim, It is you again. I couldn't remember how many times you answered my silly questions. ^_^ I am not sure assign() is what I want. Say, if I want to create 1000 linear model objects with names lm1, lm2lm1000, it seems assign can't solve it. But your second solution is close to what I a

Re: [R] how to create many objects with sequencial names?

2006-08-26 Thread jim holtman
Yes there is with statements like: assign(paste('m', i, sep='', value) But I would suggest that you put the values in a list to make it easier to access since all the data is in a single object. You could do it in a loop: result <- list() for(i in 1:100){ ..computation. result[[

[R] how to create many objects with sequencial names?

2006-08-26 Thread Wensui Liu
Dear Lister, Is there a way to create many objects with sequencial names, say lm1, lm2...lm100? Thanks. __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/post

Re: [R] Capture of iterative integration output

2006-08-26 Thread Terry W. Schulz
Thanks for the reply Sego, Landon H. The vector is created as you say. However, only the first iteration of integrate is captured. The other twenty vector values remain at 0. Integrate output includes several attributes and I only want the first one which is under $names and called "value"

Re: [R] How to iteratively extract elements out of a list

2006-08-26 Thread Gabor Grothendieck
On 8/26/06, Patrick Connolly <[EMAIL PROTECTED]> wrote: > On Sat, 26-Aug-2006 at 09:57AM +0100, Patrick Burns wrote: > > |> > sub.m <- lapply(m, function(x)x[x>2]) > |> > sub.m > |> [[1]] > |> [1] 3 4 > |> > |> [[2]] > |> [1] 4 5 > |> > |> [[3]] > |> [1] 4 > |> > |> > sub.m[unlist(lapply(sub.m,

Re: [R] How to iteratively extract elements out of a list

2006-08-26 Thread Patrick Connolly
On Sat, 26-Aug-2006 at 09:57AM +0100, Patrick Burns wrote: |> > sub.m <- lapply(m, function(x)x[x>2]) |> > sub.m |> [[1]] |> [1] 3 4 |> |> [[2]] |> [1] 4 5 |> |> [[3]] |> [1] 4 |> |> > sub.m[unlist(lapply(sub.m, function(x) length(x) == 2))] |> [[1]] |> [1] 3 4 |> |> [[2]] |> [1] 4 5 |> |>

Re: [R] Capture of iterative integration output

2006-08-26 Thread Sego, Landon H
Here's one way to do this: Before you begin the loop, define a vector to capture the output. Then each iteration of the loop will be assigned to the corresponding element in that vector: capture <- double(n) # creates a vector of length n, all with values of 0 for (i in 1:n) { _ some code _

[R] Importing data from clipboard on Mac OSX

2006-08-26 Thread Rense Nieuwenhuis
Dear R users, I am trying to get data from the clipboard into R on MacOSX. I tried the following, but got an error message: read.delim("clipboard") Error in file(file, "r") : unable to open connection In addition: Warning message: unable to contact X11 display Obviously, I'm not running R usin

[R] Permanently changing gui preferences

2006-08-26 Thread David Kaplan
Greetings, I made changes to my gui preferences and saved them. When I close and then open R, it reverts back to default preferences. How do I permanently change gui preferences? Thanks in advance. David -- David Kap

[R] Capture of iterative integration output

2006-08-26 Thread Terry W. Schulz
Hello, I am a novice R user and am having difficulty retrieving the values from 21 iterations of the R function integrate. The only way I have found is to do a write.table and then a read.table as shown in the code below. I would rather capture the 21 values inside the braces ( sapply might

[R] Type II and III sum of square in Anova (R, car package)

2006-08-26 Thread Amasco Miralisus
Hello everybody, I have some questions on ANOVA in general and on ANOVA in R particularly. I am not Statistician, therefore I would be very appreciated if you answer it in a simple way. 1. First of all, more general question. Standard anova() function for lm() or aov() models in R implements Type

[R] boxplot( ..args.., axes=FALSE, frame.plot=TRUE) doesn't frame the plot

2006-08-26 Thread Sego, Landon H
I'm running R 2.3.1 on Windows. When calling boxplot(), shouldn't the "axes" and "frame.plot" arguments get passed down to bxp()? A specific example where the plot is not framed (but seems like it should be): X <- data.frame(x=as.factor(rep(c(1,2,3), 10)), y=rnorm(30)) boxplot(y~x, data=X, fr

Re: [R] fitting a gaussian to some x,y data

2006-08-26 Thread Michael Koppelman
Whoops, I forgot to add, many thanks to all who replied publicly and privately. I am very appreciative of all comments and suggestions. Mark Leeds was especially kind in terms of clarifying why my description of the situation was so confusing. Cheers, Michael On Aug 26, 2006, at 2:51 PM, Mi

Re: [R] Implementing EM Algorithm in R!

2006-08-26 Thread Ritwik Sinha
Implementing the EM algorithm will be easy if you know what the algorithm is for your particular problem. This will be very specific to your problem. The trick is to augment your data to get something for which there is an easy ML estimate. I do not believe there is a unique recipe to perform the E

Re: [R] fitting a gaussian to some x,y data

2006-08-26 Thread Michael Koppelman
Success! The line I needed was: gcoeffs <-nls(y~(a/b)*exp(-(x-c)^2/(2*b^2)),start=list (a=0.4,b=2,c=-10), trace=TRUE) I also needed to provide good guesses for a, b and c. The attached PNG should explain what I was going after, which is the line in the center of that curve. I am sorry for

Re: [R] Can R compute the expected value of a random variable?

2006-08-26 Thread Mike Nielsen
Yes. On 8/26/06, Paul Smith <[EMAIL PROTECTED]> wrote: > Dear All > > Can R compute the expected value of a random variable? > > Thanks in advance, > > Paul > > __ > R-help@stat.math.ethz.ch mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > P

[R] Can R compute the expected value of a random variable?

2006-08-26 Thread Paul Smith
Dear All Can R compute the expected value of a random variable? Thanks in advance, Paul __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html

Re: [R] for() loop question

2006-08-26 Thread Wensui Liu
Thank you so much Marc. Your solution is exactly what I am looking for. Have a nice weekend. wensui On 8/26/06, Marc Schwartz <[EMAIL PROTECTED]> wrote: > On Sat, 2006-08-26 at 13:06 -0400, Wensui Liu wrote: > > Dear Lister, > > > > If I have a list of number, say x<-c(0.1, 0.5, 0.6...), how to

Re: [R] for() loop question

2006-08-26 Thread MARK LEEDS
let us know what you want to do because the beauty of R is that, in many cases, you may not have to loop. - Original Message - From: "Wensui Liu" <[EMAIL PROTECTED]> To: Sent: Saturday, August 26, 2006 1:06 PM Subject: [R] for() loop question > Dear Lister, > > If I have a list of nu

Re: [R] for() loop question

2006-08-26 Thread Marc Schwartz
On Sat, 2006-08-26 at 13:06 -0400, Wensui Liu wrote: > Dear Lister, > > If I have a list of number, say x<-c(0.1, 0.5, 0.6...), how to use a for() > to loop through each number in x one by one? > > Thank you so much! > > wensui Two options: x <- c(0.1, 0.5, 0.6) > for (i in x) {print (i)} [1]

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

2006-08-26 Thread Thomas Harte
--- Friedrich Leisch <[EMAIL PROTECTED]> wrote: > > On Sat, 26 Aug 2006 05:38:58 -0700 (PDT), > > Thomas Harte (TH) wrote: > > > > hallo, friedrich, and thanks for your reply. > > > if i Stangle your code i get: > > > sp<- make.ar.1(alpha=.5, n=800) > > plot(s

[R] for() loop question

2006-08-26 Thread Wensui Liu
Dear Lister, If I have a list of number, say x<-c(0.1, 0.5, 0.6...), how to use a for() to loop through each number in x one by one? Thank you so much! wensui [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list https

Re: [R] problems with loop

2006-08-26 Thread Reid Huntsinger
I think it's a scoping problem. Your function NLL() looks for "new" in the environment in which NLL() was defined, but you generate your simulated datasets in a different environment (local to sim.estim()). There are a number of ways to deal with this: - pass the dataset as a parameter to NLL()

Re: [R] How to iteratively extract elements out of a list

2006-08-26 Thread xpRt.wannabe
Thank you! On 8/26/06, Patrick Burns <[EMAIL PROTECTED]> wrote: > > sub.m <- lapply(m, function(x)x[x>2]) > > sub.m > [[1]] > [1] 3 4 > > [[2]] > [1] 4 5 > > [[3]] > [1] 4 > > > sub.m[unlist(lapply(sub.m, function(x) length(x) == 2))] > [[1]] > [1] 3 4 > > [[2]] > [1] 4 5 > > > sub4.m <- lappl

[R] Implementing EM Algorithm in R!

2006-08-26 Thread Pushkar Kumar
Hi All, I need some help in how one can implement maximumlikelihood estimation for models with discrete hidden variables in EM in R. Regards [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mail

Re: [R] How to iteratively extract elements out of a list

2006-08-26 Thread Mark Lyman
lapply(m,function(x)x[x>2]) [[1]] [1] 3 4 [[2]] [1] 4 5 [[3]] [1] 4 __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented

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

2006-08-26 Thread Friedrich Leisch
> On Sat, 26 Aug 2006 05:38:58 -0700 (PDT), > Thomas Harte (TH) wrote: > hallo, friedrich, and thanks for your reply. > if i Stangle your code i get: > sp<- make.ar.1(alpha=.5, n=800) > plot(sp, type="l", col="blue") > whereas if i Stangle my code, i get: >

Re: [R] Adding a footnote in plot-window in R

2006-08-26 Thread Rolf Turner
?legend __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.

[R] Adding a footnote in plot-window in R

2006-08-26 Thread Arun Kumar Saha
Dear all R users, Suppose, > x = rnorm(1000) > y = rt(1000,3) > plot(range(1:1000),range(x,y),type="n",xlab=NA,ylab=NA) > lines(x,col="red") > lines(y,col="blue") Now I want to put a footnote in the plot window to tell that RED lines represents the random numbers from normal-dist and blue line rep

[R] problems with loop

2006-08-26 Thread Simon Ruegg
Dear all, I am trying to evaluate the optimisation behaviour of a function. Originally I have optimised a model with real data and got a set of parameters. Now I am creating simulated data sets based on these estimates. With these simulations I am estimating the parameters again to see how vari

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

2006-08-26 Thread Thomas Harte
--- Friedrich Leisch <[EMAIL PROTECTED]> wrote: > > On Fri, 25 Aug 2006 11:05:48 -0700 (PDT), > > Thomas Harte (TH) wrote: > > i can get pretty close to this in linux by writing a function to save the > > plot to a pdf device: > > <>= > > # no savePlot in Linux ... so write my ow

Re: [R] Modifying the embed-results

2006-08-26 Thread Gabor Grothendieck
You can replace the for with lapply like this: VECTOR <- c(0, 3, 6, 3, 11, 2, 11, 4, 3, 4, 7, 7, 6, 4, 8) f <- function(i) unique(tail(VECTOR, length(VECTOR)-i+1))[1:5] out <- do.call(rbind, lapply(seq(along = VECTOR), f)) na.omit(rbind(rep(NA, 5), out)) Note that a matrix with zero rows is retu

Re: [R] Problem on Histogtam

2006-08-26 Thread jim holtman
try thie: r <- rnorm(100,4,1) hist(r, freq=FALSE) r.f <- function(x)dnorm(x, mean(r), sd(r)) curve(r.f, from=min(r), to=max(r), add=TRUE, col='red') On 8/26/06, stat stat <[EMAIL PROTECTED]> wrote: > Dear all, > > May be question seems trivial for most of the R > users, but really at least for

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

2006-08-26 Thread Friedrich Leisch
> On Fri, 25 Aug 2006 11:05:48 -0700 (PDT), > Thomas Harte (TH) wrote: > --- Prof Brian Ripley <[EMAIL PROTECTED]> wrote: >> 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 Int

Re: [R] How to iteratively extract elements out of a list

2006-08-26 Thread Patrick Burns
> sub.m <- lapply(m, function(x)x[x>2]) > sub.m [[1]] [1] 3 4 [[2]] [1] 4 5 [[3]] [1] 4 > sub.m[unlist(lapply(sub.m, function(x) length(x) == 2))] [[1]] [1] 3 4 [[2]] [1] 4 5 > sub4.m <- lapply(m, function(x)x[x>4]) > sub4.m[unlist(lapply(sub4.m, function(x) length(x) > 0))] [[1]] [1] 5

Re: [R] Memory usage decreases drastically after save workspace, quit, restart, load workspace

2006-08-26 Thread Prof Brian Ripley
On Sat, 26 Aug 2006, Klaus Thul wrote: > Dear all, > > I have the following problem: > > - I have written a program in R which runs out of physical memory > on my MacBook Pro with 1.5 GB RAM How does R know about physical memory on a virtual-memory OS? I presume the symptom is swapping by

Re: [R] generating an expression for a formula automatically

2006-08-26 Thread Prof Brian Ripley
On Fri, 25 Aug 2006, Maria Montez wrote: > Thank you for your answers yesterday. I now have another question! > > Suppose that instead of creating a formula for a regression model I > simply wanted to add the variables. I believe I cannot use the > as.formula anymore. Again I tried to use expre

[R] Problem on Histogtam

2006-08-26 Thread stat stat
Dear all, May be question seems trivial for most of the R users, but really at least for me, this comes out to be very problematic. Suppose I have the following data: > r [1] -0.0008179960 -0.0277968529 -0.0105731583 -0.0254050262 0.0321847131 0.0328170674 [7] 0.0431894392 -0.0217614918