[R] independent plotting of predicted terms with gamlss

Nikolaus Umlauf Nikolaus.Umlauf at student.uibk.ac.at
Wed Sep 19 11:04:49 CEST 2007


Hi!

I want to create a plot of a predicted term similar to the function term.plot()
in the gamlss package. I have tried several options, but I could not work it
out so far...

Thank you for your help!

Nikolaus

here is my example:

library(gamlss)
data(rent)
attach(rent)

# Estimating some model
rent.model <- gamlss(R ~ ps(Fl)+ps(A)+Sp+Sm, family="NO")
summary(rent.model)

# Predicting the values for term A
A_pred <- predict(rent.model, type="terms", what="mu", terms=2, se.fit=TRUE)

# Calculating only the fitted values without se.fit
fitted_A <- A_pred$fit

# This is my problem: I want to plot the fitted smooth function without using
the R function term.plot(), but the function lines() computes an unuseful
graph...
plot(A, fitted_A, type="n")
lines(A, fitted_A)

# I want to create a plot like term.plot() does
term.plot(rent.model, terms=2, se=TRUE)



More information about the R-help mailing list