[R] Testing Nonlinear Restrictions

2005-05-27 Thread Jacho-Chavez,DT (pgr)
Dear all,

I'm interested in testing 2 nonlinear restrictions on coefficients of a nls 
object. Is there a package for doing this? Something in the lines of `test(nls 
object, res=c(res 1,res 2),...)'
I only found the function delta.method in the alr3 library that calculates the 
se of a singleton nonlinear restriction of a nls object using the delta method.

Thanks in advanced for your help and suggestions.


David

__
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


[R] LOCFIT: What's it doing?

2005-04-14 Thread Jacho-Chavez,DT (pgr)
Dear R-users,

One of the main reasons I moved from GAUSS to R (as an econometrician) was 
because of the existence of the library LOCFIT for local polynomial regression. 
While doing some checking between my former `GAUSS code' and my new `R code', I 
came to realize LOCFIT is not quite doing what I want. I wrote the following 
example script:

#-
# Plain Vanilla NADARAYA-WATSON estimator (or Local Constant regression, e.g. 
deg=0)
# with gaussian kernel  fixed bandwidth

mkern-function(y,x,h){
Mx - matrix(x,nrow=length(y),ncol=length(y),byrow=TRUE)
Mxh - (1/h)*dnorm((x-Mx)/h)
Myxh- (1/h)*y*dnorm((x-Mx)/h)
yh - rowMeans(Myxh)/rowMeans(Mxh)
return(yh)
}

# Generating the design Y=m(x)+e
n - 10
h - 0.5
x - rnorm(n)
y - x + rnorm(n,mean=0,sd=0.5)

# This is what I really want!
mhat - mkern(y,x,h)

library(locfit)
yhl.raw - locfit(y~x,alpha=c(0,h),kern=gauss,ev=data,deg=0,link=ident)

# This is what I get with LOCFIT
print(cbind(x,mhat,residuals(yhl.raw,type=fit),knots(yhl.raw,what=coef)))
#

Questions:
1) Why are residuals(.)  knots(.) results different from one another? If I 
want m^(x[i]) at each evaluation point i=1,...,n, which one should I use? I do 
not want interpolation whatsoever.
2) Why are they `close' but not equal to what I want?

I can accept differences for higher degrees and multidimensional data at the 
boundary of the support (given the way we must do the regression in areas with 
sparse data) But why are these difference present for deg=0 inside the support 
as well as at the boundary? The computer would still give us a result even with 
a close-to-zero random denominator (admittedly, not a reliable one). 
Unfortunately, I cannot get access to a copy of Loader, C. (1999) Local 
Regression and Likelihood, Springer from my local library, so a small 
explanation or advice would be greatly appreciated.

I do not mind using an improved version of `what I want', but I would like to 
understand what am I doing?


Thanks in advanced for your help,


David Jacho-Chávez

__
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


[R] How to suppress the printing of warnings (Windows)?

2005-04-11 Thread Jacho-Chavez,DT (pgr)
Dear all,

I'm a newbie in R. I am running simulations using a fixed bandwidth in 
nonparametric regressions, sending all the output to a file myoutput.txt using 
sink(myoutput.txt),  R is printing all warnings by the end of the simulation 
on the file. I know the source of the problem  can take care of it. However, 
finding a 50 MB file (where all the output is printed, e.g. myoutput.txt) by 
the end of the simulation exercise is not quite pleasant. How could I turn them 
off completely?, so they are not printed in myoutput.txt file.

Thanks in advanced for your help.


David

__
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] How to suppress the printing of warnings (Windows)?

2005-04-11 Thread Jacho-Chavez,DT (pgr)
I'm running R v2.0.0 on Windows 2000. The command options(warn=-1) did the 
trick. However, is there a way I may also stop these warnings from printing on 
my screen while using R interactively. I am working with the LOCFIT library.

I'm also planning to run my simulations in my department's Unix machine (R 
v1.9.0) in batch mode, would `option(warn=-1)' do the trick there as well?

David

-Original Message-
From: Prof Brian Ripley [mailto:[EMAIL PROTECTED]
Sent: 11 April 2005 13:48
To: Jacho-Chavez,DT (pgr)
Cc: r-help@stat.math.ethz.ch
Subject: Re: [R] How to suppress the printing of warnings (Windows)?


On Mon, 11 Apr 2005, Jacho-Chavez,DT  (pgr) wrote:

 Dear all,

 I'm a newbie in R. I am running simulations using a fixed bandwidth in 
 nonparametric regressions, sending all the output to a file myoutput.txt 
 using sink(myoutput.txt),  R is printing all warnings by the end of 
 the simulation on the file. I know the source of the problem  can take 
 care of it. However, finding a 50 MB file (where all the output is 
 printed, e.g. myoutput.txt) by the end of the simulation exercise is not 
 quite pleasant. How could I turn them off completely?, so they are not 
 printed in myoutput.txt file.

options(warn=-1)

However, warnings and errors are sent to stderr not stdout except on 
obselete versions (95/98/ME) of Windows, and so not redirected by that 
sink() call. For me (Windows XP)

 sink(foo.out)
 warning(test)
Warning message:
test

as expected.  So is this an obsolete version of Windows or a very old 
version of R?


-- 
Brian D. Ripley,  [EMAIL PROTECTED]
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford, Tel:  +44 1865 272861 (self)
1 South Parks Road, +44 1865 272866 (PA)
Oxford OX1 3TG, UKFax:  +44 1865 272595

__
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