[R] Plot fitted vs observed values

oscar linares
2009-11-28T14:25:44Z

Dear Wiza[R]ds,

# I have the following experimentally observed data:

csdata <- data.frame(
time=c(0,1,3,9,20),
conc=c(638.697,395.69,199.00,141.58,112.16)
)

# weighting resp means response
wt.MM<- function(resp, time,A1,a1,A2,a2)
{
    pred <- A1*exp(-a1*time)+A2*exp(-a2*time)
    (resp - pred) / sqrt(pred)
}

# Fit using nls
cs.wt <- nls( ~ wt.MM(conc, time,A1,a1,A2,a2), data=csdata,
              start=list(A1=700,a1=1,A2=100,a2=0.1),
              trace = TRUE)

x<-csdata$time
y<-csdata$conc

# I want to plot the observed vs. fitted values in both linear(y) and log(y)
plots (i.e., linear and semi-log plots)
# Help appreciated...I spent over 2 hours searching archives.

# Thanks in advance.


--
Oscar
Oscar A. Linares, MD
Translational Medicine Unit
LaPlaisance Bay, Bolles Harbor
Monroe, Michigan 48161

	[[alternative HTML version deleted]]