[R] smartpred depends on fitted() in flexmix?

Michael Kubovy kubovy at virginia.edu
Thu Feb 8 14:41:04 CET 2007


Hi,

I was going through the examples in smartpred. It seems there's an  
unstated dependency on the fitted() function in package flexmix.

n = 20
set.seed(86)
x = sort(runif(n))
y = sort(runif(n))
library(splines)
fit = lm(y ~ ns(x, df=5))
plot(x, y)
lines(x, fitted(fit)) # won't work w/o prior loading of the flexmix  
package.
newx = seq(0, 1, len=n)
points(newx, predict(fit, data.frame(x=newx)), type="b", col=2, err=-1)
_____________________________
Professor Michael Kubovy
University of Virginia
Department of Psychology
USPS:     P.O.Box 400400    Charlottesville, VA 22904-4400
Parcels:    Room 102        Gilmer Hall
         McCormick Road    Charlottesville, VA 22903
Office:    B011    +1-434-982-4729
Lab:        B019    +1-434-982-4751
Fax:        +1-434-982-4766
WWW:    http://www.people.virginia.edu/~mk9y/



More information about the R-help mailing list