Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
Mastering Scientific Computing with R

You're reading from   Mastering Scientific Computing with R Employ professional quantitative methods to answer scientific questions with a powerful open source data analysis environment

Arrow left icon
Product type Paperback
Published in Jan 2015
Publisher
ISBN-13 9781783555253
Length 432 pages
Edition 1st Edition
Languages
Arrow right icon
Toc

Table of Contents (12) Chapters Close

Preface 1. Programming with R 2. Statistical Methods with R FREE CHAPTER 3. Linear Models 4. Nonlinear Methods 5. Linear Algebra 6. Principal Component Analysis and the Common Factor Model 7. Structural Equation Modeling and Confirmatory Factor Analysis 8. Simulations 9. Optimization 10. Advanced Data Management Index

Visually exploring nonlinear relationships


Let's say that we want to understand the relationship between height, weight, age, and gender. We probably have some preconceived notions about how these variables relate to one another (for example, taller people probably tend to weigh more). Let's perform the following steps:

  1. Firstly, load the data and attach the data frame using the following code:

    body.measures <- read.csv('nhanes_body.txt')
    attach(body.measures)
  2. Now, let's just look at the data visually, as shown in the following diagram, an important first step in most analyses. Let's have a look at the following function:

    plot(age, height, xlab = 'Age', ylab = 'Height', main = 'Height vs Age')

The previous dataset has thousands of data points, so a simple plot with default graphics options looks messy but it is clear that this is not a linear relationship. However, even the previous plot shows us some features about the relationship between age and height. The most obvious feature is that the...

lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $19.99/month. Cancel anytime
Banner background image