[R] Fit non-lineair 3D Data

From: Bart Joosen <bartjoosen_at_hotmail.com>
Date: Mon 19 Dec 2005 - 07:08:54 EST


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:

    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]]

R-help@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 Received on Mon Dec 19 07:21:11 2005

This archive was generated by hypermail 2.1.8 : Fri 03 Mar 2006 - 03:41:40 EST