[R] Fwd: Forcing coefficents in lm(), recursive residuals, etc.

From: Rick Ram <r.ramyar_at_gmail.com>
Date: Fri 29 Jul 2005 - 04:23:33 EST

Resending cos I think this didn't get through for some reason... apologies if it arrives twice!

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.

        [[alternative HTML version deleted]]



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 Received on Fri Jul 29 04:30:04 2005

This archive was generated by hypermail 2.1.8 : Fri 03 Mar 2006 - 03:34:07 EST