Re: [R] AR vs ARIMA question

2011-07-07 Thread apjaworski
This indeed seems to be the case. Running ar(xb, order=1, method="mle") and arima(xb,order=c(1,0,0),include.mean=FALSE) give essentially the same results. It looks to me that ar with method="mle" turns around and calls arima function, so there is no big surprize there. Cheers,

Re: [R] dynlm

2011-06-21 Thread apjaworski
Dave, I am not sure what you try to do, but I have a couple of thoughts: 1. Your t.hh is numerically identical to t.h, except the latter one is the time series. 2. I am guessing you want the same thing for t.d and t.m. If this is the case, all you need to do is repeat what you did with t.h:

[R] A small problem with PDF manuals

2011-04-19 Thread apjaworski
Hello, I am not sure if I have done something wrong or something changed between 12.2.2 and 2.13.0, but I just installed R-2.13.0 from CRAN install executable on 64 bit Windows 7 Pro and when I try "Help>Manuals (in PDF)>An Introduction to R" I get the following Error: 'doc\manual\R-intro.pd

Re: [R] Levelplot

2010-05-21 Thread apjaworski
I am not sure if I am correct but I think the labels argument pertains only to the counterplot function. Cheers, Andy __ Andy Jaworski 518-1-01 Process Laboratory 3M Corporate Research Laboratory - E-mail: apjawor...@mmm.com Tel: (651) 733-6092 Fax: (651) 7

Re: [R] Curve Fitting

2010-04-30 Thread apjaworski
Thomas, I think the issue of having reasonable starting values is inherent in all nonlinear optimization problems (unless they have some additional properties like convexity, for example). Using a different algorithm may or may not help. In fact, a vast majority of existing algorithms guaran

[R] Data frame question

2010-03-12 Thread apjaworski
Hi, I have the following question about creating data frames. I want to create a data frame with 2 components: a vector and a matrix. Let me use a simple example: y <- rnorm(10) x <- matrix(rnorm(150), nrow=10) Now if I do dd <- data.frame(x=x, y=y) I get a data frame with 16 colums, but if

Re: [R] new help pages in R 2.10.0

2009-11-05 Thread apjaworski
Antonio, Starting from 2.10, R dropped its support for Windows CHM help. It has been replaced with the web browser HTML based one. To activate this add the following line to your Rprofile options(help_type="html") The pages come up in your browser. They all have the same links as before.

Re: [R] Constrained Optimization

2009-11-04 Thread apjaworski
Hi, This probably does not answer your question, which I presume is about the workings of constrOptim function, but I have a couple of comments and different solutions of your problem. 1. In general, in the problem of this type, one can incorporate the equality constraint(s) into the objectiv

[R] R to MATLAB translation

2009-08-10 Thread apjaworski
Hi, Is there any package out there that might help me with translating R code into MATLAB? Using RSiteSearch I found a bunch of "MATLAB stuff" but it all seems to go in the opposite direction, i.e., emulating MATLAB functions in R. Thanks in advance, Andy __

Re: [R] Problems with subsets in NLME

2009-06-25 Thread apjaworski
Rebecca, I think the problem is that subset is a nume of an R function. If you do something like subs <- c(rep(TRUE, 107), FALSE) fm2 <- lme(distance ~ age + Sex, data = Orthodont, random = ~ 1, subset=subs) everything works fine. Hope this helps, Andy __ An

Re: [R] Basic Vector and Matrix Operations

2008-07-07 Thread apjaworski
Here is a solution: 1. c(x, rep(NA, n-length(x))) 2. which(x==2, arr.ind=TRUE) Cheers Andy __ Andy Jaworski 518-1-01 Process Laboratory 3M Corporate Research Laboratory - E-mail: [EMAIL PROTECTED] Tel: (651) 733-6092 Fax: (651) 736-3122 "Eric Turkheimer"

Re: [R] Assistance in installing R

2008-05-27 Thread apjaworski
My Linux is pretty rusty, but I think the error message means what is says: you do not have readline header (*.h) and library files. They usually reside in readline-devel package if I remember correctly. Hope this helps, Andy __ Andy Jaworski 518-1-01 Process Lab

Re: [R] Fit a sine to data

2008-05-23 Thread apjaworski
Milan, This is a fairly standard trick. Let us generalize your equation slightly: y ~ a + c*sin(x+b) so the amplitude of the sine wave is adjustable (otherwise, you assume (or know) that the amplitude is 1). Then y ~ a + c*sin(b)*cos(x) + c*cos(b)*sin(x) or y ~ b0 + b1*x1 + b2*x2 which is

Re: [R] Newbie question about vector matrix multiplication

2008-05-14 Thread apjaworski
Dan, You need to do diag(w) %*% as.matrix(co) %*% diag(w) The reason is that read.table creates a data frame. Although it looks like a matrix it is not - actually it is a special kind of list. The "as.matrix" function will coerce it to a matrix. By the way, this will generate m[i,j]=w[i]*co[

Re: [R] Rpart and bagging - how is it done?

2008-03-07 Thread apjaworski
I would like to thank Brian Ripley and Torsten Hothorn for their quick and thoughtful responses. I rerun the example given by Professor Ripley by just starting R and sourcing the code below and I got slightly different results. Then I ran it again setting the random seed before the sample command

[R] Rpart and bagging - how is it done?

2008-03-06 Thread apjaworski
Hi there. I was wondering if somebody knows how to perform a bagging procedure on a classification tree without running the classifier with weights. Let me first explain why I need this and then give some details of what I have found out so far. I am thinking about implementing the bagging proc

Re: [R] one-way anova power calculations

2008-02-19 Thread apjaworski
Will, Your SAS input indicates that within standard deviation is 9, not the variance. If you use within.var=81 in your R statement you will get the answer matching SAS. Cheers, Andy __ Andy Jaworski 518-1-01 Process Laboratory 3M Corporate Research Laboratory --

Re: [R] Polynomial fitting

2008-01-07 Thread apjaworski
Jonas, In statistical sense polynomial is a linear regression fit. The function that handles linear fitting is called lm. Here is how you can reproduce your results: lm(y ~ x + I(x^2) + I(x^3)) Unless you are really after the polynomial coefficients it is probably better to use orthogonal poly

Re: [R] MS Excel Data

2007-11-29 Thread apjaworski
Here is a very crude function I use quite often. It tries to recognize whether you have headers or not by checking the very first character. If it is numeric, it assumes that there are no headers. The suppressWarnings gets rid of a warning one gets when trying to coerce a character to numeric.