Hi,

I have a problem with fitting a model:

I made a dataframe with this data:

a <- 1:3

b <- 1:3

c <- c(3, 2, 3, 2, 1, 2, 3, 2, 3)

df <- expand.grid(a,b)

df$result <- c

names(df) <- c("A","B", "result")

Although I can make a graph of the data:

require(lattice)

wireframe(result~A*B, data=df)

I can't get a model to fit this 3D data.

I have tried the lm function, but its easy to see that this a non lineair data set. The use of poly also isn't a solution.

I tried to use nls, but there seems to be an error?

mod <- nls(result~A:B, df, start = list (A=0, B=0))

Error in qr.qty(QR, resid) : 'qr' and 'y' must have the same number of rows

Is there a way to fit this data?

Thanks for your time by reading this, hopefully I will get an answer.

Bart Joosen

[[alternative HTML version deleted]]

______________________________________________

[hidden email] mailing list

https://stat.ethz.ch/mailman/listinfo/r-helpPLEASE do read the posting guide!

http://www.R-project.org/posting-guide.html