From: Spencer Graves <spencer.graves_at_pdf.com>

Date: Sun 31 Jul 2005 - 12:46:21 EST

[1] 1.2799320 0.7232336 3.4826581

>

>>Sorry guys, resending this - none of my posts have gone through

*>>because HTML emails where not being delivered... sending this
*

*>>plaintext now!
*

*>>
*

*>>On 28/07/05, Rick Ram <r.ramyar@gmail.com> wrote:
*

*>>
*

*>>>Resending cos I think this didn't get through for some reason... apologies
*

*>>>if it arrives twice!
*

*>>>
*

*>>>
*

*>>>---------- Forwarded message ----------
*

*>>>From: Rick Ram < r.ramyar@gmail.com>
*

*>>>Date: 28-Jul-2005 18:03
*

*>>>Subject: Forcing coefficents in lm(), recursive residuals, etc.
*

*>>>To: R-help <r-help@stat.math.ethz.ch >
*

*>>>
*

*>>>Hello all,
*

*>>>
*

*>>>Does anyone know how to constrain/force specific coefficients when running
*

*>>>lm()?
*

*>>>
*

*>>>I need to run recresid() {strucchange package} on the residuals of
*

*>>>forecast.lm, but forecast.lm's coefficients must be determined by
*

*>>>parameter.estimation.lm
*

*>>>
*

*>>>I could estimate forecast.lm without lm() and use some other kind of
*

*>>>optimisation, but recresid() requires an object with class lm. recresid()
*

*>>>allows you to specify a formula, rather than an lm object, but it looks like
*

*>>>coefficients are estimated this way too and can't be forced.
*

*>>>
*

*>>>Here is a bit of code to compensate for my poor explanation:.
*

*>>>
*

*>>># Estimate the coefficients of model
*

*>>>parameter.estimation.lm = lm(formula = y ~ x1 + x2, data =
*

*>>>estimation.dataset)
*

*>>># How do I force the coefficients in forecast.lm to the coeff estimation
*

*>>>from parameter.estimation.lm??
*

*>>>
*

*>>>forecast.lm = lm(formula = y ~ x1 + x2, data = forecast.dataset)
*

*>>># Because I need recursive residuals from the application of the
*

*>>>coefficients from parameter.estimation.lm to a different dataset
*

*>>>recresid(forecast.lm)
*

*>>>
*

*>>>Thanks in advance guys,
*

*>>>
*

*>>>R.
*

*>>
*

Date: Sun 31 Jul 2005 - 12:46:21 EST

I know nothing about recresid, but does the following help:

> x <- 1:4 > set.seed(1) > DF <- data.frame(x=x, y=x+rnorm(4)) > fit <- lm(y~offset(x), DF) > recresid(fit)

[1] 1.2799320 0.7232336 3.4826581

>

spencer graves

Rick Ram wrote:

> Hi all, > Just to clarify, I know that the predict() function would the normal > avenue for applying a model but the problem is that I need to > calculate recursive residuals, and the recresid() function needs an > object with class "lm". > Best, > R. > > On 28/07/05, Rick Ram <r.ramyar@gmail.com> wrote: >

>>Sorry guys, resending this - none of my posts have gone through

> > ______________________________________________ > 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

-- Spencer Graves, PhD Senior Development Engineer PDF Solutions, Inc. 333 West San Carlos Street Suite 700 San Jose, CA 95110, USA spencer.graves@pdf.com www.pdf.com <http://www.pdf.com> Tel: 408-938-4420 Fax: 408-280-7915 ______________________________________________ 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.htmlReceived on Sun Jul 31 12:51:00 2005

*
This archive was generated by hypermail 2.1.8
: Sun 23 Oct 2005 - 14:59:56 EST
*