Re: [R] using color palette in persp

2010-08-18 Thread szisziszilvi

I remembered wrong, the problem rised int the next line to the mentioned one,
z was wrong, and I didn't see way. But new day, new point of wiew. For
anybody's interest here is the solution.

The original try was this:

x <- seq(-1.95, 1.95, length = 30)
y <- seq(-1.95, 1.95, length = 35)
z <- as.matrix(read.table(file="mSample.dat")) # mSample.dat looks like
this: "   104  107" (... 32l, 48c)
... (the same as in the example) ...
persp(x, y, z, col=color[facetcol], phi=30, theta=-30)

And it's wrong at the first three line. Now obviously, because z won't be a
30x35 matrix, but just az large as it's determined in the file. So I placed
the first lines with this:

z <- as.matrix(read.table(file="mSample.dat"))
x <- seq(1, nrow(z))
y <- seq(1, ncol(z))

which is probably better in this case, because the z values are not
calculated from x and y, so it's no point to determine their lenghts
manually.
-- 
View this message in context: 
http://r.789695.n4.nabble.com/using-color-palette-in-persp-tp2328464p2329451.html
Sent from the R help mailing list archive at Nabble.com.

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] using color palette in persp

2010-08-17 Thread szisziszilvi

yes, I had, and failed somehow, because I couldn't work out some points. I
don't have my work with me at the moment, but will give a detailed
description about my porblems. I don't remember for sure what I tried and
what not, but I failed at this line:

zfacet <- z[-1, -1] + z[-1, -ncz] + z[-nrz, -1] + z[-nrz, -ncz]

and I think there must be failures somewhere before - although no warning
messages were found just for this line. Coming back tomorrow (here i'ts
late).
-- 
View this message in context: 
http://r.789695.n4.nabble.com/using-color-palette-in-persp-tp2328464p2328843.html
Sent from the R help mailing list archive at Nabble.com.

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] using color palette in persp

2010-08-17 Thread szisziszilvi

Hello!

I am using persp to get a plot of a 32x48 matrix.
data <- as.matrix(read.table(file="mySample.dat"))
persp(data)

And I'm having trouble with trying to give a z-dependent palette to it like
rainbow (or any built in one would do). How to combine that with the "col"
argument?

nice day
Szilvi

-- 
View this message in context: 
http://r.789695.n4.nabble.com/using-color-palette-in-persp-tp2328464p2328464.html
Sent from the R help mailing list archive at Nabble.com.

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] non-linear regression for 3D data

2010-08-15 Thread szisziszilvi

Thanks a lot, this I(xx^2) ... worked.
I guess, I should learn more abot the function poly itself. (so will I... :)
)

Thanks again!
-- 
View this message in context: 
http://r.789695.n4.nabble.com/non-linear-regression-for-3D-data-tp2320982p2325911.html
Sent from the R help mailing list archive at Nabble.com.

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] non-linear regression for 3D data

2010-08-12 Thread szisziszilvi

right. How does it come that if I devide the result vector with
10*interception, I get a much better result?

> zz2 <- 25.86 -2239.86*mp$xx -595.01*mp$xx*mp$xx + 2875.54*mp$yy +
> 776.84*mp$yy*mp$yy
> mp$zz2 <- zz2
> library(lattice)
> cloud(zz2/258.6 + zz ~ xx * yy, data=mp)


looks quite pretty.

http://r.789695.n4.nabble.com/file/n2322812/output.jpeg 
-- 
View this message in context: 
http://r.789695.n4.nabble.com/non-linear-regression-for-3D-data-tp2320982p2322812.html
Sent from the R help mailing list archive at Nabble.com.

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] non-linear regression for 3D data

2010-08-12 Thread szisziszilvi

I've tried lm, but something is wrong.
I've made a test dataset of 599 data points, my original equation is

zz = 1 +0.5*xx -3.2*xx*xx -1*yy +4.2*yy*yy

but the R gives this result:
---
> mp <- read.csv(file="sample.csv",sep=";",header=TRUE)
> lm(zz ~ poly(xx,2) + poly(yy,2), data=mp)

Call:
lm(formula = zz ~ poly(xx, 2) + poly(yy, 2), data = mp)

Coefficients:
 (Intercept)  poly(xx, 2)1  poly(xx, 2)2  poly(yy, 2)1  poly(yy, 2)2  
   25.86  -2239.86   -595.01   2875.54776.84
---
which is definitely not the original. :(

(In case of interest the test dataset is available here:
szisziszilvi.lima-city.de/r)
-- 
View this message in context: 
http://r.789695.n4.nabble.com/non-linear-regression-for-3D-data-tp2320982p2322779.html
Sent from the R help mailing list archive at Nabble.com.

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] non-linear regression for 3D data

2010-08-11 Thread szisziszilvi

oh, god, please don't tell anybody...
-- 
View this message in context: 
http://r.789695.n4.nabble.com/non-linear-regression-for-3D-data-tp2320982p2321082.html
Sent from the R help mailing list archive at Nabble.com.

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] non-linear regression for 3D data

2010-08-11 Thread szisziszilvi

Hello!

Is there a simplier way in R to get a nonlinear regression (like nls) for a
surface? I have 3D data, and it is definitely not a linear surface with
which it would fit the best. Rather sg like z = a + f(x) + g(y) where
probably both f and g are polinomes (hopefully quadratic).

Szilvia
-- 
View this message in context: 
http://r.789695.n4.nabble.com/non-linear-regression-for-3D-data-tp2320982p2320982.html
Sent from the R help mailing list archive at Nabble.com.

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] 3d data plot

2010-08-11 Thread szisziszilvi

Hello!

er.. do I need to calculate the values into a grid, or is there a way to
plot it without that? E.g cloud works, but I can't seem to get a surface
like that.

eg I made a test csv with some data

library(lattice)
mp <- read.csv("myPolinom.csv", sep=";", header=TRUE)
cloud(zz~xx*yy, data=mp) # works
wireframe(zz~xx*yy, data=mp) # does not work - because it would need the
grid points in a matrix? else?

other solution is also welcome...
-- 
View this message in context: 
http://r.789695.n4.nabble.com/3d-data-plot-tp2306540p2320935.html
Sent from the R help mailing list archive at Nabble.com.

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] 3d data plot

2010-08-09 Thread szisziszilvi

Hello!

E.g. I have a file like sample.csv:
condition1;condition2;myVar
0.902443929;0.879344831;0.963357725
0.91014254;0.717720763;0.953787867
0.899773581;0.871760835;1.031798755
0.892074969;0.863043345;1.080447426
0.847759139;0.894642857;1.080521187
0.847179086;0.89650009;1.111348011
0.849229318;0.912751303;1.154026236
(... some thousands of measurements, like (p,V,T) - just other types of
physical quantities)
(wherever a data misses, it's sign is -999)

I can read it into a data frame like:
mes <- read.csv("sample.csv", sep=";", na.strings="-999")

But what shall I do afterwards? I've tried to understand persp, but that
doesn't really seem to be the solution.

Maybe it would help if you could tell me just which example to check more
carefully on the mentioned page. I've tried to search for one, but failed
unfortunatelly.
-- 
View this message in context: 
http://r.789695.n4.nabble.com/3d-data-plot-tp2306540p2318397.html
Sent from the R help mailing list archive at Nabble.com.

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] 3d data plot

2010-07-29 Thread szisziszilvi

Hello!

I'm a newbe, and a bit confused amongst the data types and functions...

The problem to be solved is the following: We have measurements. They are in
a csv file, in 3 columns. So this would be an x-y-z plot, where z is the
measurement at (x,y) conditions. Just a simple plot, nothing special. Dots,
surface columns - doesn't matter to me. I just can't figure it out somehow.

Szilvia
-- 
View this message in context: 
http://r.789695.n4.nabble.com/3d-data-plot-tp2306540p2306540.html
Sent from the R help mailing list archive at Nabble.com.

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.