Re: [R] Estimation of AR(1) model by QML.

2013-12-30 Thread Prof Brian Ripley
On 30/12/2013 22:57, Simon Zehnder wrote: Why not using optim on the likelihood in a) with normally distributed standard errors and for b) optim with a likelihood with t(3)-distributed standard errors? Because evaluating the likelihood is a tricky business here. I don't know what is meant by

Re: [R] aes and parameter evaluation problems

2013-12-30 Thread Jeff Newmiller
A.K. answered your question 1, but since you did say as question 2 that you wanted it done right... library(reshape2) ex3 <- function() { d <- data.frame(x=1:5,a=1:5,b=2:6,c=3:7) dl <- melt( d, id.vars="x" ) ggplot(dl,aes(x=x,y=value,color=variable))+ geom_line() }

Re: [R] adding a fram around R plot

2013-12-30 Thread Jim Lemon
On 12/31/2013 02:21 AM, Tohamy Yousef wrote: Hi all, I need to know how to put a closed frame around my plot. I am plotting using the field package, and I have been able to use box() with limited success. Box() puts a border around only a part of the plot area not all. I saw that there was

Re: [R] aes and parameter evaluation problems

2013-12-30 Thread arun
Hi, Try: ex2 <- function() {   d <- data.frame(x=1:5,a=1:5,b=2:6,c=3:7)   g <- ggplot(d, aes(x))     for (n in c("a","b","c")) {     g <- g + geom_line(aes_string(y=n,colour=n))   }  return(g) } A.K. On Monday, December 30, 2013 7:49 PM, Geoffrey wrote: I am trying add geom_line's using a l

[R] aes and parameter evaluation problems

2013-12-30 Thread Geoffrey
I am trying add geom_line's using a loop but the nature of unevaluated parameters is causing me problems. This code works: ex <- function() { d <- data.frame(x=1:5,a=1:5,b=2:6,c=3:7) g <- ggplot(d, aes(x)) g <- g + geom_line(aes(y=a,colour=a)) + geom_line(aes(y=b,colour=b)) + g

[R] cumulative incidence for mstate in Survival package in R

2013-12-30 Thread Jieyue Li
Dear All, I want to have the cumulative incidence curves for 'mstate' data using Survival package in R. But I got some problems: I. Problem 1: 1. If I only use intercept without any covariates, I can have 'right' cumulative incidence curves (2 for 2 competing risks): library(Survival) fitCI <- sur

Re: [R] dist() or cmdscale() function help

2013-12-30 Thread Kerrio Brown
Nevermind on this questions, I was able to solve the issue by using as.dist() instead of dist(). Thanks, Kerrio On Mon, Dec 30, 2013 at 2:38 PM, Kerrio Brown wrote: > Hi, > > I'm trying to understand what are the appropriate input for the dist() > function ( > http://stat.ethz.ch/R-manual/R-pa

[R] adding a fram around R plot

2013-12-30 Thread Tohamy Yousef
Hi all,  I need to know how to put a closed frame around my plot.  I am  plotting using the field package, and I have been able to use box() with limited  success. Box() puts a border around only a part of  the  plot area not all. I saw that there was a similar problem in this group but I used t

[R] howto join matrices produced by rcorr()

2013-12-30 Thread Alexander Schuster
Hi, i have used rcorr() for calculating pearsons r and according p-values for my data, giving me 2 matrices. Now I would like to print scatterplots for all results with "good" correlation values. So i need a way to extract the row-name and column-name for each item in the matrix with "good" r-va

[R] MTM power spectrum

2013-12-30 Thread catalin roibu
Dear R users, I have a big problem with R. I want to make a multitaper power spectrum analysis of a time series using 3 tapers and a resolution of two years with robust background noise estimation. I try different packages but unsuccessful. library(multitaper) d<-spec.mtm(CAMstd, nw=2, k=3,delta

Re: [R] Milliken and Johnson Unbalanced Machines

2013-12-30 Thread Simon Zehnder
I don’t know anything about this topic, but looking into this book: http://books.google.de/books?id=3TVDQBAJ&pg=PA25&lpg=PA25&dq=milliken+and+johnson+unbalanced+machines&source=bl&ots=lxqStiQju5&sig=d5dG_cHsTzilCIklBrW9SAMKYRM&hl=de&sa=X&ei=ifrBUuvoM8qPtAbPqoCQDQ&ved=0CGUQ6AEwBQ#v=onepage&q=mi

Re: [R] Estimation of AR(1) model by QML.

2013-12-30 Thread Simon Zehnder
Why not using optim on the likelihood in a) with normally distributed standard errors and for b) optim with a likelihood with t(3)-distributed standard errors? Best Simon On 30 Dec 2013, at 21:19, Xuse Chuse wrote: > Dear Users, > > I am trying to estimate a model Y(t)=alpha+rho*Y(t-1)+e(t)

[R] Milliken and Johnson Unbalanced Machines

2013-12-30 Thread Troels Ring
Dear friends - reading Milliken and Johnson on messy data I failed to find R code to master the unbalanced Machines data in ch 23. I wonder if anyone can lend me a hand - again Happy new year Troels Ring Aalborg, Denmark __ R-help@r-project.org mailing

Re: [R] What purpose is served by reflexive function assignments?

2013-12-30 Thread Andrew Hoerner
Dear David-- I think I am straight on the dopiness of my original question. In trying to make sure I understand your example, I ran this function below. It seems to assign the value of V from the calling environment to X as a default, ignored if X is given a value positionally, used if not. It doe

Re: [R] What purpose is served by reflexive function assignments?

2013-12-30 Thread Andrew Hoerner
Dear Bill-- Your final question has my confusion tagged exactly. Thanks so much for your time and attention! andrewH On Sun, Dec 29, 2013 at 5:47 PM, William Dunlap wrote: > On Dec 28, 2013, at 7:27 PM, Andrew Hoerner wrote: > > > Let us suppose that we have a function foo(X) which is called

[R] Estimation of AR(1) model by QML.

2013-12-30 Thread Xuse Chuse
Dear Users, I am trying to estimate a model Y(t)=alpha+rho*Y(t-1)+e(t) where i know e(t)~t(3). a) I want to estimate (alpha, rho) by QML estimation assuming (wrongly) that e(t)~N(0,sigma2) and calculate the standard errors. b) Estimate (alpha, rho) by ML estimation assuming (correctly) e(t)~t(3)

Re: [R] Package dependencies in building R packages

2013-12-30 Thread Duncan Murdoch
On 13-12-30 2:01 PM, Axel Urbiz wrote: Thanks for your kind response Duncan. To be more specific, I'm using the function mvrnorm from MASS. The issue is that MASS depends on survival and I have a function in my package named tt() which conflicts with a function in survival of the same name. I can

Re: [R] Package dependencies in building R packages

2013-12-30 Thread Axel Urbiz
Thanks for your kind response Duncan. To be more specific, I'm using the function mvrnorm from MASS. The issue is that MASS depends on survival and I have a function in my package named tt() which conflicts with a function in survival of the same name. I can think of 2 alternatives solutions to my

Re: [R] Package dependencies in building R packages

2013-12-30 Thread Duncan Murdoch
On 13-12-30 1:24 PM, Axel Urbiz wrote: Dear users, My package {foo} depends on a function "miscFUN" which is on package {foo_depend}. This last package also depends on other packages, say {A, B, C}, but miscFUN is not dependent on A, B, C (only on foo_depend). In my package {foo}, is there a wa

Re: [R] need help with distribution graphics

2013-12-30 Thread capricy gao
Thanks a lot! On Saturday, December 28, 2013 2:54 PM, Jim Lemon wrote: On 12/29/2013 03:41 AM, capricy gao wrote: > Really? > > OK, here the linked is an example: > > http://iai.asm.org/content/77/10/4631/F1.expansion.html > > > Please, any input would be appreciated! > > Hi Capricy, Reall

[R] Package dependencies in building R packages

2013-12-30 Thread Axel Urbiz
Dear users, My package {foo} depends on a function "miscFUN" which is on package {foo_depend}. This last package also depends on other packages, say {A, B, C}, but miscFUN is not dependent on A, B, C (only on foo_depend). In my package {foo}, is there a way to only have it depend on the function

Re: [R] Which R version is the package "ts" available for.

2013-12-30 Thread David Winsemius
On Dec 29, 2013, at 10:24 PM, Jeff Newmiller wrote: You know, Google could have helped you with this question. E.g. http://r.789695.n4.nabble.com/library-ts-not-available-td3688535.html fortunes::fortune("'Liaw-Baron principle'") ---

Re: [R] matrix propagation problem

2013-12-30 Thread David Winsemius
On Dec 29, 2013, at 7:21 PM, Gregory Carey wrote: Please see the code and R output below. I cannot understand why a matrix object is being propagated in row major order by default and then in column major order when byrow=TRUE is specified when I use one set of dimensions. But when I use d

Re: [R] I have a problem in doing the scatterplot

2013-12-30 Thread arun
Hi, Try: tab1 <- read.table("132p1vs132p2",sep="\t",header=TRUE)  str(tab1) #'data.frame':    1765 obs. of  2 variables: # $ Sample_132p1: num  2.395 0 0.216 0 0.246 ... # $ Sample_132p2: num  2.428 0 0.247 0 0.136 ... plot(tab1$Sample_132p1,tab1$Sample_132p2,pch=20) fm <- lm(tab1$Sample_132p2~ta

Re: [R] Trying to optimize a graph

2013-12-30 Thread Adams, Jean
Here's one approach. I changed to the graph a bit to include the extremes of all of the curves, which may or may not be what you want. Jean a <- 0.05 b <- 1 kr <- c(70, 60, 50) K <- kr/a colz <- c("blue","green","red") # determine the limits of the graph maxatx <- kr*b/(2*a) maxaty <- kr*maxatx

Re: [R] What purpose is served by reflexive function assignments?

2013-12-30 Thread Ista Zahn
On Sun, Dec 29, 2013 at 11:37 PM, andrewH wrote: > Dear Ista-- > Peter's post has already persuaded me that my original question was based on > several misunderstandings and so difficult if not impossible to follow -- > though he did a remarkable job of figuring out where I was going astray and >