derek_rampal_midterm

derek_rampal_midterm - Derek Rampal Midterm Qian 1a) > x...

Info iconThis preview shows pages 1–5. Sign up to view the full content.

View Full Document Right Arrow Icon
Derek Rampal Midterm Qian 1a) > x <- c(1,3,4,5,6) > y <-c(3,2,5,1,4) > x%*%y #dot product      [,1] [1,]   58 b) > xpts <- (-500:500)*pi/500; ypts <- sin(xpts)+2*xpts;ypts2<- sin(xpts)+xpts;ypts1 <- sin(xpts);  ypts3 <- sin(xpts)-xpts*xpts; plot(xpts,ypts,xlim=c(-pi,pi),ylim=c(-10,2*pi),xlab ="x",  ylab="y",col="blue") 
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
lines(xpts,ypts1,col="red");lines(xpts,ypts2,col="green");lines(xpts,ypts3,col="black") -3 -2 -1 0 1 2 3 -10 -5 0 5 x y Blue = sinx +2x; red=sinx ; green = sinx +x; black = sinx-x^2;
Background image of page 2
2a)  library(DAAG)  data <-swiss  attach(data)  summary(data)  Fertility       Agriculture     Examination      Education         Catholic        Infant.Mortality  Min.   :35.00    Min.   : 1.20    Min.   : 3.00    Min.   : 1.00    Min.   :  2.150    Min.   :10.80     1st Qu.:64.70    1st Qu.:35.90    1st Qu.:12.00    1st Qu.: 6.00    1st  Qu.:  5.195    1st Qu.:18.15     Median :70.40  Median :54.10   Median :16.00   Median : 8.00    Median : 15.140 Median :20.00     Mean   :70.14    Mean   :50.66    Mean   :16.49    Mean   :10.98    Mean  : 41.144    Mean   :19.94     3rd Qu.:78.45    3rd Qu.:67.65    3rd Qu.:22.00    3rd Qu.:12.00   3rd  Qu.: 93.125    3rd Qu.:21.70     Max.   :92.50    Max.   :89.70    Max.   :37.00    Max.   :53.00    Max.   : 100.000    Max.   :26.60 b) 6 vars, fertility, agriculture, examination, education, catholic, infant.mortality…used summary c)   str(data) #determine data structure 'data.frame':   47 obs. of  6 variables: 47 observations d)  pairs(data,panel=panel.smooth)
Background image of page 3

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Fertility 0 20 40 60 80 0 10 20 30 40 50 15 20 25 40 60 80 0 20 6080 Agriculture Examination 5 15 25 35 10 30 50 Education Catholic 100 40 50 60 70 80 90 5 10 15 20 25 30 35 0 20 40 60 80 100 Infant.Mortality e) Fertility shows some linear relationship with most variables except categorical education, and  nonlinear categorical catholic.  Shows little of no relationship with infant.mortalitiy. Agriculture shows similar trend to fertility.
Background image of page 4
Image of page 5
This is the end of the preview. Sign up to access the rest of the document.

Page1 / 15

derek_rampal_midterm - Derek Rampal Midterm Qian 1a) &gt; x...

This preview shows document pages 1 - 5. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online