[R] Predict using SparseM.slm
roger koenker
rkoenker at uiuc.edu
Thu Aug 2 00:57:53 CEST 2007
If you are feeling altruistic you could write a predict method for
slm objects, it wouldn't be much work to adapt what is already
available and follow the predict.lm prototype. On the other
hand if you are looking for something quick and dirty you can
always resort to
newX %*% coef(slmobj)
url: www.econ.uiuc.edu/~roger Roger Koenker
email rkoenker at uiuc.edu Department of Economics
vox: 217-333-4558 University of Illinois
fax: 217-244-6678 Champaign, IL 61820
On Aug 1, 2007, at 4:42 PM, T. Balachander wrote:
> Hi,
>
> I am trying out the SparseM package and had the a
> question. The following piece of code works fine:
>
> ...
> fit = slm(model, data = trainData, weights = weight)
>
> ...
>
> But how do I use the fit object to predict the values
> on say a reserved testDataSet? In the regular lm
> function I would do something like this:
>
> predict.lm(fit,testDataSet)
>
> Thanks
> -Bala
>
>
>
>
> ______________________________________________________________________
> ______________
>
> ______________________________________________
> R-help at 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
> and provide commented, minimal, self-contained, reproducible code.
More information about the R-help
mailing list