Hello,

It really looked like homework. As for your question, maybe this helps.

URL <- "http://r.789695.n4.nabble.com/file/n4685033/cylinder.dat";
cyl <- read.table(URL, header = TRUE)
plot(vol ~ ht, data = cyl)

The vectors you want are simply

cyl$vol
cyl[["vol"]]
cyl[[1]]

and the same for height.
To find the radius you can note that your formula is equivalent to V=pi*r^2*H and use something like (note that the model has no intercept)

fit <- lm(vol ~ 0 + ht, data = cyl)
summary(fit)

r <- sqrt(coef(fit)/pi)
r

For linear models in R start by reading the file R-intro.pdf that comes with any installation of R, folder 'doc' chapter 11 Statistical models in R.

Hope this helps,

Rui Barradas

Em 11-02-2014 06:06, nivek escreveu:
Thank you for your help. This is not homework however and my difficulty is in
the fact that i cannot figure out how the declare a variable for the height
or the volume given a data set where the matrix is already formed. I have
looked on many sites for the is answer and it seems like it would be an easy
one. So for this problem the provided data column 2 is the height data and
column 1 is the volume. What command do I use to read those values and form
a vector. Thank you for your time.



--
View this message in context: 
http://r.789695.n4.nabble.com/How-to-write-a-regression-model-for-finding-the-radius-of-a-cylinder-given-height-and-volume-tp4685033p4685090.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-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.

Reply via email to