Descriptive_Statistics_Lesson_3(2)

pdf

School

University of Louisville *

*We aren’t endorsed by this school

Course

680

Subject

Statistics

Date

Feb 20, 2024

Type

pdf

Pages

140

Uploaded by CoachCaterpillarMaster1073

Report
PHST 680 Descriptive Statistics Lesson 3
Descriptive Statistics | Describing Multivariate Data
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help
R Packages Before beginning this section, please ensure that the following R packages have been installed and loaded. I lattice
R Packages Before beginning this section, please ensure that the following R packages have been installed and loaded. I lattice I mosaic
1 Quantitative & 1 Categorical Variable The iris data set gives the measurements in centimeters of the sepal length and width and petal length and width for 50 flowers from each of 3 species of iris. iris ## Sepal.Length Sepal.Width Petal.Length Petal.Width ## 1 5.1 3.5 1.4 0.2 ## 2 4.9 3.0 1.4 0.2 ## 3 4.7 3.2 1.3 0.2 ## 4 4.6 3.1 1.5 0.2 ## 5 5.0 3.6 1.4 0.2 ## 6 5.4 3.9 1.7 0.4 ## 7 4.6 3.4 1.4 0.3 ## 8 5.0 3.4 1.5 0.2 ## 9 4.4 2.9 1.4 0.2 ## 10 4.9 3.1 1.5 0.1 ## 11 5.4 3.7 1.5 0.2 ## 12 4.8 3.4 1.6 0.2
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help
1 Quantitative & 1 Categorical Variable | Panelled Histogram histogram (~Sepal.Length | Species, data = iris)
1 Quantitative & 1 Categorical Variable | Panelled Histogram histogram (~Sepal.Length | Species, data = iris) Sepal Length (cm) Density 0.0 0.2 0.4 0.6 0.8 1.0 5 6 7 8 setosa versicolor 0.0 0.2 0.4 0.6 0.8 1.0 virginica
1 Quantitative & 1 Categorical Variable | Panelled Histogram histogram (~Sepal.Length | Species, data = iris, layout = c ( 1 , 3 ))
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help
1 Quantitative & 1 Categorical Variable | Panelled Histogram histogram (~Sepal.Length | Species, data = iris, layout = c ( 1 , 3 )) Sepal Length (cm) Density 0.0 0.4 0.8 5 6 7 8 setosa 0.0 0.4 0.8 versicolor 0.0 0.4 0.8 virginica
1 Quantitative & 1 Categorical Variable | Panelled Box Plot bwplot (~Sepal.Length | Species, data = iris)
1 Quantitative & 1 Categorical Variable | Panelled Box Plot bwplot (~Sepal.Length | Species, data = iris) Sepal Length (cm) 5 6 7 8 setosa versicolor virginica
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help
1 Quantitative & 1 Categorical Variable | Panelled Box Plot bwplot (~Sepal.Length | Species, data = iris, layout = c ( 1 , 3 )) Sepal Length (cm) 5 6 7 8 setosa versicolor virginica
1 Quantitative & 1 Categorical Variable | Parallel Box Plots bwplot (Species ~ Sepal.Length, data = iris)
1 Quantitative & 1 Categorical Variable | Parallel Box Plots bwplot (Species ~ Sepal.Length, data = iris) Sepal Length (cm) setosa versicolor virginica 5 6 7 8
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help
1 Quantitative & 1 Categorical Variable | Panelled Density Plot densityplot (~Sepal.Length | Species, data = iris, layout = c ( 1 , 3 ))
1 Quantitative & 1 Categorical Variable | Panelled Density Plot densityplot (~Sepal.Length | Species, data = iris, layout = c ( 1 , 3 )) Sepal Length (cm) Density 0.0 0.5 1.0 4 5 6 7 8 setosa 0.0 0.5 1.0 versicolor 0.0 0.5 1.0 virginica
1 Quantitative & 1 Categorical Variable | Grouped Density Plot densityplot (~Sepal.Length, groups = Species, data = iris, auto.key = TRUE )
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help
1 Quantitative & 1 Categorical Variable | Grouped Density Plot densityplot (~Sepal.Length, groups = Species, data = iris, auto.key = TRUE ) Sepal Length (cm) Density 0.0 0.5 1.0 4 5 6 7 8 setosa versicolor virginica
1 Quantitative & 1 Categorical Variable | Numerically favstats (~Sepal.Length | Species, data = iris)
1 Quantitative & 1 Categorical Variable | Numerically favstats (~Sepal.Length | Species, data = iris) ## Species min Q1 median Q3 max mean sd n ## 1 setosa 4.3 4.800 5.0 5.2 5.8 5.006 0.3524897 50 ## 2 versicolor 4.9 5.600 5.9 6.3 7.0 5.936 0.5161711 50 ## 3 virginica 4.9 6.225 6.5 6.9 7.9 6.588 0.6358796 50
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help
2 Quantitative Variables The iris data set gives the measurements in centimeters of the sepal length and width and petal length and width for 50 flowers from each of 3 species of iris. iris ## Sepal.Length Sepal.Width Petal.Length Petal.Width ## 1 5.1 3.5 1.4 0.2 ## 2 4.9 3.0 1.4 0.2 ## 3 4.7 3.2 1.3 0.2 ## 4 4.6 3.1 1.5 0.2 ## 5 5.0 3.6 1.4 0.2 ## 6 5.4 3.9 1.7 0.4 ## 7 4.6 3.4 1.4 0.3 ## 8 5.0 3.4 1.5 0.2 ## 9 4.4 2.9 1.4 0.2 ## 10 4.9 3.1 1.5 0.1 ## 11 5.4 3.7 1.5 0.2 ## 12 4.8 3.4 1.6 0.2
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help
2 Quantitative Variables | Scatterplot xyplot (Sepal.Length ~ Sepal.Width, data = iris)
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help
2 Quantitative Variables | Scatterplot xyplot (Sepal.Length ~ Sepal.Width, data = iris) Sepal Width (cm) Sepal Length (cm) 5 6 7 8 2.0 2.5 3.0 3.5 4.0 4.5
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help
2 Quantitative Variables | Correlation The direction and closeness of the cluster of points in a scatterplot is quantified by the correlation . Correlation refers to the extent of which two variables have a linear relationship. VaryCorrelation ()
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help
2 Quantitative Variables xyplot (Sepal.Length ~ Sepal.Width, data = iris) Sepal Width (cm) Sepal Length (cm) 5 6 7 8 2.0 2.5 3.0 3.5 4.0 4.5
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help
2 Quantitative Variables | Correlation cor (Sepal.Length ~ Sepal.Width, data = iris)
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help
2 Quantitative Variables | Correlation cor (Sepal.Length ~ Sepal.Width, data = iris) ## [1] -0.1175698
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help
2 Quantitative & 1 Categorical Variable The iris data set gives the measurements in centimeters of the sepal length and width and petal length and width for 50 flowers from each of 3 species of iris. iris ## Sepal.Length Sepal.Width Petal.Length Petal.Width ## 1 5.1 3.5 1.4 0.2 ## 2 4.9 3.0 1.4 0.2 ## 3 4.7 3.2 1.3 0.2 ## 4 4.6 3.1 1.5 0.2 ## 5 5.0 3.6 1.4 0.2 ## 6 5.4 3.9 1.7 0.4 ## 7 4.6 3.4 1.4 0.3 ## 8 5.0 3.4 1.5 0.2 ## 9 4.4 2.9 1.4 0.2 ## 10 4.9 3.1 1.5 0.1 ## 11 5.4 3.7 1.5 0.2 ## 12 4.8 3.4 1.6 0.2
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help
2 Quantitative & 1 Categorical Variable | Panelled Scatterplot xyplot (Sepal.Length ~ Sepal.Width | Species, data = iris)
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help
2 Quantitative & 1 Categorical Variable | Panelled Scatterplot xyplot (Sepal.Length ~ Sepal.Width | Species, data = iris) Sepal Width (cm) Sepal Length (cm) 5 6 7 8 2.0 2.5 3.0 3.5 4.0 4.5 setosa versicolor 5 6 7 8 virginica
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help
2 Quantitative & 1 Categorical Variable | Grouped Scatterplot xyplot (Sepal.Length ~ Sepal.Width, groups = Species, data = iris, auto.key = TRUE )
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help
2 Quantitative & 1 Categorical Variable | Grouped Scatterplot xyplot (Sepal.Length ~ Sepal.Width, groups = Species, data = iris, auto.key = TRUE ) Sepal Width (cm) Sepal Length (cm) 5 6 7 8 2.0 2.5 3.0 3.5 4.0 4.5 setosa versicolor virginica
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help
2 Quantitative & 1 Categorical Variable | Correlation by Group # create separate groups setosa <- subset (iris, Species == "setosa" ) versicolor <- subset (iris, Species == "versicolor" ) virginica <- subset (iris, Species == "virginica" )
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help
2 Quantitative & 1 Categorical Variable | Correlation by Group # report correlations for each group cor (Sepal.Length ~ Sepal.Width, data = setosa) ## [1] 0.7425467 cor (Sepal.Length ~ Sepal.Width, data = versicolor) ## [1] 0.5259107 cor (Sepal.Length ~ Sepal.Width, data = virginica) ## [1] 0.4572278
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help
2 Categorical Variables | Two-Way Table The Whickham data set contains survey data on 1,314 UK women from 1972-74 on their smoking status and age along with their survival status after 20 years. Whickham ## outcome smoker age ## 1 Alive Yes 23 ## 2 Alive Yes 18 ## 3 Dead Yes 71 ## 4 Alive No 67 ## 5 Alive No 64 ## 6 Alive Yes 38 ## 7 Alive Yes 45 ## 8 Dead No 76 ## 9 Alive No 28 ## 10 Alive No 27 ## 11 Alive No 28 ## 12 Alive Yes 34
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help
2 Categorical Variables | Two-Way Table xtabs (~smoker + outcome, data = Whickham)
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help
2 Categorical Variables | Two-Way Table xtabs (~smoker + outcome, data = Whickham) ## outcome ## smoker Alive Dead ## No 502 230 ## Yes 443 139
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help
2 Categorical Variables | Mosaic Plot mosaicplot (~outcome + smoker, data = Whickham)
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help
2 Categorical Variables | Mosaic Plot mosaicplot (~outcome + smoker, data = Whickham) Whickham outcome smoker Alive Dead No Yes
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help
2 Categorical Variables | Row Percents rowPerc ( xtabs (~smoker + outcome, data = Whickham))
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help
2 Categorical Variables | Row Percents rowPerc ( xtabs (~smoker + outcome, data = Whickham)) ## outcome ## smoker Alive Dead Total ## No 68.58 31.42 100.00 ## Yes 76.12 23.88 100.00
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help
Descriptive Statistics | Case Study 1
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help
R Packages Before beginning this section, please ensure that the following R packages have been installed and loaded. I lattice
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help
R Packages Before beginning this section, please ensure that the following R packages have been installed and loaded. I lattice I mosaic
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help
Effects of Lead Exposure The data set LEAD.DAT on the Companion Website includes raw data for the study of effects of exposure to lead on the psychological and neurological well-being of children. Blood levels of lead were measured in a group of children who lived near a lead smelter in El Paso, TX.
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help
Effects of Lead Exposure Control Group (Group 1) I 78 children Exposed Group (Group 2) All children lived close to the lead smelter.
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help
Effects of Lead Exposure Control Group (Group 1) I 78 children I Blood-lead levels < 40 μ g/mL Exposed Group (Group 2) All children lived close to the lead smelter.
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help
Effects of Lead Exposure Control Group (Group 1) I 78 children I Blood-lead levels < 40 μ g/mL Exposed Group (Group 2) I 46 children All children lived close to the lead smelter.
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help
Effects of Lead Exposure Control Group (Group 1) I 78 children I Blood-lead levels < 40 μ g/mL Exposed Group (Group 2) I 46 children I Blood-lead levels 40 μ g/mL All children lived close to the lead smelter.
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help
Effects of Lead Exposure Two outcome variables were examined: I Number of finger-wrist taps in the dominant hand (a measure of neurological function)
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help
Effects of Lead Exposure Two outcome variables were examined: I Number of finger-wrist taps in the dominant hand (a measure of neurological function) I Wechsler full-scale IQ score
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help
Effects of Lead Exposure Start by loading the data into R . # Set working directory setwd ( "~/Dropbox/University of Louisville/ PHST 680/Data Sets/ Rosner_7th_Data_Sets CSV files/ASCII-comma" )
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help
Effects of Lead Exposure Start by loading the data into R . # Set working directory setwd ( "~/Dropbox/University of Louisville/ PHST 680/Data Sets/ Rosner_7th_Data_Sets CSV files/ASCII-comma" ) # Load data set. lead <- read.csv ( "LEAD.DAT.txt" )
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help
Effects of Lead Exposure To make sure the data loaded as expected, take a look at the first handful of rows. head (lead)
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help
Effects of Lead Exposure To make sure the data loaded as expected, take a look at the first handful of rows. head (lead) ## X.id. X.area. X.ageyrs. X.sex. X.iqv_inf. X.iqv_comp. ## 1 101 3 11.08 1 3 4 ## 2 102 3 9.42 1 7 9 ## 3 103 3 11.08 1 4 9 ## 4 104 2 6.92 1 4 6 ## 5 105 1 11.25 1 5 4 ## 6 106 2 6.50 1 5 12 ## X.iqv_ds. X.iqv_raw. X.iqp_pc. X.iqp_bd. X.iqp_oa. X.i ## 1 5 15 10 8 8 ## 2 6 29 8 7 10 ## 3 3 21 10 7 7 ## 4 6 22 5 8 5 ## 5 5 22 5 10 13 ## 6 9 37 14 7 7
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help
Effects of Lead Exposure You may also be interested in how many rows and columns your data has. dim (lead)
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help
Effects of Lead Exposure You may also be interested in how many rows and columns your data has. dim (lead) ## [1] 124 40
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help
Effects of Lead Exposure Check out the column names. names (lead)
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help
Effects of Lead Exposure Check out the column names. names (lead) ## [1] "X.id." "X.area." "X.ageyrs." "X.sex." ## [6] "X.iqv_comp." "X.iqv_ar." "X.iqv_ds." "X.iqv_ra ## [11] "X.iqp_bd." "X.iqp_oa." "X.iqp_cod." "X.iqp_ra ## [16] "X.iqv." "X.iqp." "X.iqf." "X.iq_typ ## [21] "X.Group." "X.ld72." "X.ld73." "X.fst2yr ## [26] "X.pica." "X.colic." "X.clumsi." "X.irrit. ## [31] "X._2plat_r." "X._2plar_l." "X.visrea_r." "X.visrea ## [36] "X.audrea_l." "X.fwt_r." "X.fwt_l." "X.hypera
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help
Effects of Lead Exposure Check out the column names. They seem cumbersome! names (lead) ## [1] "X.id." "X.area." "X.ageyrs." "X.sex." ## [6] "X.iqv_comp." "X.iqv_ar." "X.iqv_ds." "X.iqv_ra ## [11] "X.iqp_bd." "X.iqp_oa." "X.iqp_cod." "X.iqp_ra ## [16] "X.iqv." "X.iqp." "X.iqf." "X.iq_typ ## [21] "X.Group." "X.ld72." "X.ld73." "X.fst2yr ## [26] "X.pica." "X.colic." "X.clumsi." "X.irrit. ## [31] "X._2plat_r." "X._2plar_l." "X.visrea_r." "X.visrea ## [36] "X.audrea_l." "X.fwt_r." "X.fwt_l." "X.hypera
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help
Effects of Lead Exposure Let’s get rid of some of the unnecessary symbols. names (lead) <- gsub ( "X." , "" , names (lead))
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help
Effects of Lead Exposure Let’s get rid of some of the unnecessary symbols. names (lead) <- gsub ( "X." , "" , names (lead)) names (lead) ## [1] "id." "area." "ageyrs." "sex." "iq ## [6] "iqv_comp." "iqv_ar." "iqv_ds." "iqv_raw." "iq ## [11] "iqp_bd." "iqp_oa." "iqp_cod." "iqp_raw." "hh ## [16] "iqv." "iqp." "iqf." "iq_type." "le ## [21] "Group." "ld72." "ld73." "fst2yrs." "to ## [26] "pica." "colic." "clumsi." "irrit." "co ## [31] "_2plat_r." "_2plar_l." "visrea_r." "visrea_l." "au ## [36] "audrea_l." "fwt_r." "fwt_l." "hyperact." "ma
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help
Effects of Lead Exposure Let’s get rid of some of the unnecessary symbols. names (lead) <- gsub ( "_2pla" , "pla" , names (lead))
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help
Effects of Lead Exposure Let’s get rid of some of the unnecessary symbols. names (lead) <- gsub ( "_2pla" , "pla" , names (lead)) names (lead) ## [1] "id." "area." "ageyrs." "sex." "iq ## [6] "iqv_comp." "iqv_ar." "iqv_ds." "iqv_raw." "iq ## [11] "iqp_bd." "iqp_oa." "iqp_cod." "iqp_raw." "hh ## [16] "iqv." "iqp." "iqf." "iq_type." "le ## [21] "Group." "ld72." "ld73." "fst2yrs." "to ## [26] "pica." "colic." "clumsi." "irrit." "co ## [31] "plat_r." "plar_l." "visrea_r." "visrea_l." "au ## [36] "audrea_l." "fwt_r." "fwt_l." "hyperact." "ma
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help
Effects of Lead Exposure Let’s get rid of some of the unnecessary symbols. names (lead) <- gsub ( "\\." , "" , names (lead))
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help
Effects of Lead Exposure Let’s get rid of some of the unnecessary symbols. names (lead) <- gsub ( "\\." , "" , names (lead)) names (lead) ## [1] "id" "area" "ageyrs" "sex" "iqv_in ## [7] "iqv_ar" "iqv_ds" "iqv_raw" "iqp_pc" "iqp_bd ## [13] "iqp_cod" "iqp_raw" "hh_index" "iqv" "iqp" ## [19] "iq_type" "lead_grp" "Group" "ld72" "ld73" ## [25] "totyrs" "pica" "colic" "clumsi" "irrit" ## [31] "plat_r" "plar_l" "visrea_r" "visrea_l" "audrea ## [37] "fwt_r" "fwt_l" "hyperact" "maxfwt"
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help
Effects of Lead Exposure Read the documentation from the Companion Website on the dataset. The following variables should be categorical: area , sex , iq_type , lead_grp , Group , fst2yrs , pica , colic , clumsi , irrit , convul
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help
Effects of Lead Exposure Take a look at the structure of each column. str (lead)
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help
Effects of Lead Exposure Take a look at the structure of each column. All of the categorical variables were imported as quantitative. str (lead) ## data.frame : 124 obs. of 40 variables: ## $ id : int 101 102 103 104 105 106 107 108 109 11 ## $ area : int 3 3 3 2 1 2 3 1 2 2 ... ## $ ageyrs : num 11.08 9.42 11.08 6.92 11.25 ... ## $ sex : int 1 1 1 1 1 1 1 2 2 1 ... ## $ iqv_inf : int 3 7 4 4 5 5 7 3 13 7 ... ## $ iqv_comp: int 4 9 9 6 4 12 9 1 10 9 ... ## $ iqv_ar : int 3 7 5 6 8 11 10 3 14 12 ... ## $ iqv_ds : int 5 6 3 6 5 9 7 6 13 9 ... ## $ iqv_raw : int 15 29 21 22 22 37 33 13 50 37 ... ## $ iqp_pc : int 10 8 10 5 5 14 10 6 8 6 ... ## $ iqp_bd : int 8 7 7 8 10 7 8 2 15 9 ... ## $ iqp_oa : int 8 10 7 5 13 7 7 3 14 12 ... ## $ iqp_cod : int 5 9 20 13 12 10 16 8 9 13 ...
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help
Effects of Lead Exposure # list the variables you want to change # to factor mylist <- c ( "area" , "sex" , "iq_type" , "lead_grp" , "Group" , "fst2yrs" , "pica" , "colic" , "clumsi" , "irrit" , "convul" )
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help
Effects of Lead Exposure # list the variables you want to change # to factor mylist <- c ( "area" , "sex" , "iq_type" , "lead_grp" , "Group" , "fst2yrs" , "pica" , "colic" , "clumsi" , "irrit" , "convul" ) # change variables to factor lead[, mylist] <- lapply (lead[, mylist], factor)
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help
Effects of Lead Exposure # list the variables you want to change # to factor mylist <- c ( "area" , "sex" , "iq_type" , "lead_grp" , "Group" , "fst2yrs" , "pica" , "colic" , "clumsi" , "irrit" , "convul" ) # change variables in names to factor lead[, mylist] <- lapply (lead[, mylist], factor) # check structure again str (lead) ## data.frame : 124 obs. of 40 variables: ## $ id : int 101 102 103 104 105 106 107 108 109 11 ## $ area : Factor w/ 3 levels "1","2","3": 3 3 3 2 1 2 ## $ ageyrs : num 11.08 9.42 11.08 6.92 11.25 ... ## $ sex : Factor w/ 2 levels "1","2": 1 1 1 1 1 1 1 2
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help
Effects of Lead Exposure Q1: How does lead exposure ( Group ) affect number of finger-wrist taps ( maxfwt ) in the dominant hand? I maxfwt is a quantitative , discrete variable ( outcome variable )
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help
Effects of Lead Exposure Q1: How does lead exposure ( Group ) affect number of finger-wrist taps ( maxfwt ) in the dominant hand? I maxfwt is a quantitative , discrete variable ( outcome variable ) I Group is a categorical variable with two factors ( explanatory variable )
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help
Effects of Lead Exposure Q1: How does lead exposure ( Group ) affect number of finger-wrist taps ( maxfwt ) in the dominant hand? I maxfwt is a quantitative , discrete variable ( outcome variable ) I Group is a categorical variable with two factors ( explanatory variable ) I 1=no exposure
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help
Effects of Lead Exposure Q1: How does lead exposure ( Group ) affect number of finger-wrist taps ( maxfwt ) in the dominant hand? I maxfwt is a quantitative , discrete variable ( outcome variable ) I Group is a categorical variable with two factors ( explanatory variable ) I 1=no exposure I 2=exposure
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help
Effects of Lead Exposure Compare the number of finger-wrist taps by group graphically . bwplot (Group ~ maxfwt, data = lead) Effect of Lead Exposure # Finger-Wrist Taps in Dominant Hand Group 1 2 20 40 60 80 100
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help
Effects of Lead Exposure Compare the number of finger-wrist taps by group graphically . densityplot (~maxfwt, groups = Group, data = lead, auto.key = TRUE ) Effect of Lead Exposure Density 0.000 0.005 0.010 0.015 0.020 0.025 0.030 0 50 100 1 2
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help
Effects of Lead Exposure Compare the number of finger-wrist taps by group numerically . favstats (~maxfwt | Group, data = lead) ## Group min Q1 median Q3 max mean sd n m ## 1 1 13 50.0 57 71.00 99 62.43590 20.37607 78 ## 2 2 13 42.5 52 79.75 99 59.76087 25.00861 46
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help
Effects of Lead Exposure Q1: How does lead exposure ( Group ) affect number of finger-wrist taps ( maxfwt ) in the dominant hand?
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help
Effects of Lead Exposure Q1: How does lead exposure ( Group ) affect number of finger-wrist taps ( maxfwt ) in the dominant hand? Conclusion: Based on the graphical and numerical exploratory analysis, it appears that the distributions of finger-wrist taps in the dominant hand are similar between the exposed and unexposed groups. However, the unexposed group has a higher average number of finger-wrist taps than the exposed group and less variability in the observations.
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help
Effects of Lead Exposure Q2: How does lead exposure ( Group ) affect IQ scores ( iqf ), as measured by Wechsler full-scale IQ scores? I iqf is a quantitative , discrete variable ( outcome variable )
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help
Effects of Lead Exposure Q2: How does lead exposure ( Group ) affect IQ scores ( iqf ), as measured by Wechsler full-scale IQ scores? I iqf is a quantitative , discrete variable ( outcome variable ) I Group is a categorical variable with two factors ( explanatory variable )
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help
Effects of Lead Exposure Q2: How does lead exposure ( Group ) affect IQ scores ( iqf ), as measured by Wechsler full-scale IQ scores? I iqf is a quantitative , discrete variable ( outcome variable ) I Group is a categorical variable with two factors ( explanatory variable ) I 1=no exposure
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help
Effects of Lead Exposure Q2: How does lead exposure ( Group ) affect IQ scores ( iqf ), as measured by Wechsler full-scale IQ scores? I iqf is a quantitative , discrete variable ( outcome variable ) I Group is a categorical variable with two factors ( explanatory variable ) I 1=no exposure I 2=exposure
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help
Effects of Lead Exposure Compare the IQ scores by group graphically . bwplot (Group ~ iqf, data = lead) Effect of Lead Exposure Wechsler Full-Scale IQ Score Group 1 2 60 80 100 120 140
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help
Effects of Lead Exposure Compare the IQ scores by group graphically . densityplot (~iqf, groups = Group, data = lead, auto.key = TRUE ) Effect of Lead Exposure Density 0.00 0.01 0.02 0.03 40 60 80 100 120 140 160 1 2
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help
Effects of Lead Exposure Compare the IQ scores by group numerically . favstats (~iqf | Group, data = lead) ## Group min Q1 median Q3 max mean sd n mi ## 1 1 50 85 94 101.00 141 92.88462 15.34451 78 ## 2 2 46 80 88 93.75 114 88.02174 12.20654 46
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help
Effects of Lead Exposure Q2: How does lead exposure ( Group ) affect IQ scores ( iqf ), as measured by Wechsler full-scale IQ scores? Conclusion: Based on the graphical and numerical exploratory analysis, it appears that the distributions of IQ are similar between the exposed and unexposed groups. However, the unexposed group appears to have a higher average IQ than the exposed group with more variability in the observations.
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help
Descriptive Statistics | Case Study 2
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help
R Packages Before beginning this section, please ensure that the following R packages have been installed and loaded. I lattice
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help
R Packages Before beginning this section, please ensure that the following R packages have been installed and loaded. I lattice I mosaic
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help
Effects of Tobacco Use The data set BONEDEN.DAT on the Companion Website includes raw data for the study of the effects of tobacco use on bone-mineral density in middle-aged women. 41 pairs of middle-aged female twins who had different smoking histories were enrolled in the study.
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help
Effects of Tobacco Use Data collected (via questionnaire) I details of tobacco use (expressed in terms of pack-years )
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help
Effects of Tobacco Use Data collected (via questionnaire) I details of tobacco use (expressed in terms of pack-years ) I alcohol, coffee, tea consumption
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help
Effects of Tobacco Use Data collected (via questionnaire) I details of tobacco use (expressed in terms of pack-years ) I alcohol, coffee, tea consumption I calcium intake
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help
Effects of Tobacco Use Data collected (via questionnaire) I details of tobacco use (expressed in terms of pack-years ) I alcohol, coffee, tea consumption I calcium intake I menopausal, reproductive, and fracture history
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help
Effects of Tobacco Use Data collected (via questionnaire) I details of tobacco use (expressed in terms of pack-years ) I alcohol, coffee, tea consumption I calcium intake I menopausal, reproductive, and fracture history I use of oral contraceptives or estrogen replacement therapy
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help
Effects of Tobacco Use Data collected (via questionnaire) I details of tobacco use (expressed in terms of pack-years ) I alcohol, coffee, tea consumption I calcium intake I menopausal, reproductive, and fracture history I use of oral contraceptives or estrogen replacement therapy I physical activity
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help
Effects of Tobacco Use Exposed Twin I > 0 pack-years Control Twin Genetic influences on bone density are controlled for by using twins as matched pairs .
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help
Effects of Tobacco Use Exposed Twin I > 0 pack-years Control Twin I 0 pack-years Genetic influences on bone density are controlled for by using twins as matched pairs .
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help
Effects of Tobacco Use The difference in the BMD (bone-mineral density) was assessed at three different sites: I lumbar spine (lower back)
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help
Effects of Tobacco Use The difference in the BMD (bone-mineral density) was assessed at three different sites: I lumbar spine (lower back) I femoral neck (hip)
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help
Effects of Tobacco Use The difference in the BMD (bone-mineral density) was assessed at three different sites: I lumbar spine (lower back) I femoral neck (hip) I femoral shaft (hip)
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help
Effects of Tobacco Use Start by loading the data into R . # Set working directory setwd ( "~/Dropbox/University of Louisville/ PHST 680/Data Sets/ Rosner_7th_Data_Sets CSV files/ASCII-comma" ) # Load data set. bd <- read.csv ( "BONEDEN.DAT.txt" )
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help
Effects of Tobacco Use Make sure the data loaded as expected. Start by taking a look at the first handful of rows. head (bd) ## X.ID. X.age. X.zyg. X.ht1. X.wt1. X.tea1. X.cof1. X. ## 1 1002501 27 2 162 57 35 0 ## 2 1015401 42 2 165 76 42 2 ## 3 1027601 59 2 150 114 12 0 ## 4 1034301 61 1 159 62 56 0 ## 5 1121202 47 2 159 58 28 14 ## 6 1162502 33 2 163 49 35 0 ## X.men1. X.pyr1. X.ls1. X.fn1. X.fs1. X.ht2. X.wt2. X.t ## 1 0 0 0.81 0.72 1.00 160 56 ## 2 1 0 1.01 0.74 0.99 159 72 ## 3 1 0 0.75 0.63 1.05 156 54 ## 4 1 0 0.81 0.64 1.12 162 58 ## 5 0 0 0.78 0.70 1.14 150 58 ## 6 0 0 0.86 0.56 1.13 158 54
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help
Effects of Tobacco Use You may also be interested in how many rows and columns your data has. dim (bd) ## [1] 41 25
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help
Effects of Tobacco Use Check out the column names. names (bd) ## [1] "X.ID." "X.age." "X.zyg." "X.ht1." "X.wt1." " ## [8] "X.alc1." "X.cur1." "X.men1." "X.pyr1." "X.ls1." " ## [15] "X.ht2." "X.wt2." "X.tea2." "X.cof2." "X.alc2." " ## [22] "X.pyr2." "X.ls2." "X.fn2." "X.fs2."
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help
Effects of Tobacco Use The column names are cumbersome, so let’s get rid of some of the unnecessary symbols. names (bd) <- gsub ( "X" , "" , names (bd)) names (bd) <- gsub ( "\\." , "" , names (bd))
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help
Effects of Tobacco Use The column names are cumbersome, so let’s get rid of some of the unnecessary symbols. names (bd) <- gsub ( "X" , "" , names (bd)) names (bd) <- gsub ( "\\." , "" , names (bd)) # Look at column names again names (bd) ## [1] "ID" "age" "zyg" "ht1" "wt1" "tea1" "cof1" "a ## [11] "pyr1" "ls1" "fn1" "fs1" "ht2" "wt2" "tea2" "c ## [21] "men2" "pyr2" "ls2" "fn2" "fs2"
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help
Effects of Tobacco Use The following variables should be categorical: I zyg
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help
Effects of Tobacco Use The following variables should be categorical: I zyg I men1
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help
Effects of Tobacco Use The following variables should be categorical: I zyg I men1 I men2
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help
Effects of Tobacco Use Take a look at the variable type. Hopefully all is as expected! str (bd) ## data.frame : 41 obs. of 25 variables: ## $ ID : int 1002501 1015401 1027601 1034301 1121202 11 ## $ age : int 27 42 59 61 47 33 45 73 43 43 ... ## $ zyg : int 2 2 2 1 2 2 1 1 2 2 ... ## $ ht1 : int 162 165 150 159 159 163 169 160 162 165 .. ## $ wt1 : int 57 76 114 62 58 49 78 76 64 58 ... ## $ tea1: int 35 42 12 56 28 35 42 42 7 7 ... ## $ cof1: int 0 2 0 0 14 0 0 14 28 21 ... ## $ alc1: int 1 3 0 0 0 3 1 14 8 6 ... ## $ cur1: int 1 5 0 0 0 1 1 8 3 0 ... ## $ men1: int 0 1 1 1 0 0 0 1 0 1 ... ## $ pyr1: num 0 0 0 0 0 0 0 25 0.5 0 ... ## $ ls1 : num 0.81 1.01 0.75 0.81 0.78 0.86 0.95 0.76 0. ## $ fn1 : num 0.72 0.74 0.63 0.64 0.7 0.56 0.83 0.56 0.6 ## $ fs1 : num 1 0.99 1.05 1.12 1.14 1.13 1.16 1.05 1.07
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help
Effects of Tobacco Use # list the variables you want to change # to factor mylist <- c ( "zyg" , "men1" , "men2" )
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help
Effects of Tobacco Use # list the variables you want to change # to factor mylist <- c ( "zyg" , "men1" , "men2" ) # change variables in names to factor bd[, mylist] <- lapply (bd[, mylist], factor)
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help
Effects of Tobacco Use # list the variables you want to change # to factor mylist <- c ( "zyg" , "men1" , "men2" ) # change variables in names to factor bd[, mylist] <- lapply (bd[, mylist], factor) # check structure again str (bd) ## data.frame : 41 obs. of 25 variables: ## $ ID : int 1002501 1015401 1027601 1034301 1121202 11 ## $ age : int 27 42 59 61 47 33 45 73 43 43 ... ## $ zyg : Factor w/ 2 levels "1","2": 2 2 2 1 2 2 1 1 2 2 ## $ ht1 : int 162 165 150 159 159 163 169 160 162 165 .. ## $ wt1 : int 57 76 114 62 58 49 78 76 64 58 ... ## $ tea1: int 35 42 12 56 28 35 42 42 7 7 ... ## $ cof1: int 0 2 0 0 14 0 0 14 28 21 ...
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help
Effects of Tobacco Use Research Question: How does tobacco use affect within-pair differences of BMD at the lumbar spine? I Difference in Tobacco use = pyr2 - pyr1
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help
Effects of Tobacco Use Research Question: How does tobacco use affect within-pair differences of BMD at the lumbar spine? I Difference in Tobacco use = pyr2 - pyr1 I quantitative ,
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help
Effects of Tobacco Use Research Question: How does tobacco use affect within-pair differences of BMD at the lumbar spine? I Difference in Tobacco use = pyr2 - pyr1 I quantitative , I continuous ,
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help
Effects of Tobacco Use Research Question: How does tobacco use affect within-pair differences of BMD at the lumbar spine? I Difference in Tobacco use = pyr2 - pyr1 I quantitative , I continuous , I explanatory variable
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help
Effects of Tobacco Use Research Question: How does tobacco use affect within-pair differences of BMD at the lumbar spine? I Difference in Tobacco use = pyr2 - pyr1 I quantitative , I continuous , I explanatory variable I Difference in Lumbar Spine BMD = ls2 - ls1 average ( ls2 , ls1 ) · 100 %
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help
Effects of Tobacco Use Research Question: How does tobacco use affect within-pair differences of BMD at the lumbar spine? I Difference in Tobacco use = pyr2 - pyr1 I quantitative , I continuous , I explanatory variable I Difference in Lumbar Spine BMD = ls2 - ls1 average ( ls2 , ls1 ) · 100 % I quantitative ,
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help
Effects of Tobacco Use Research Question: How does tobacco use affect within-pair differences of BMD at the lumbar spine? I Difference in Tobacco use = pyr2 - pyr1 I quantitative , I continuous , I explanatory variable I Difference in Lumbar Spine BMD = ls2 - ls1 average ( ls2 , ls1 ) · 100 % I quantitative , I continuous ,
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help
Effects of Tobacco Use Research Question: How does tobacco use affect within-pair differences of BMD at the lumbar spine? I Difference in Tobacco use = pyr2 - pyr1 I quantitative , I continuous , I explanatory variable I Difference in Lumbar Spine BMD = ls2 - ls1 average ( ls2 , ls1 ) · 100 % I quantitative , I continuous , I outcome variable
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help
Effects of Tobacco Use It might also be interesting to distinguish our results between the type of twins. I zyg = Fraternal/Identical Twin Indicator
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help
Effects of Tobacco Use It might also be interesting to distinguish our results between the type of twins. I zyg = Fraternal/Identical Twin Indicator I Monozygotic (identical) = 1
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help
Effects of Tobacco Use It might also be interesting to distinguish our results between the type of twins. I zyg = Fraternal/Identical Twin Indicator I Monozygotic (identical) = 1 I Dizygotic (fraternal) = 2
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help
Effects of Tobacco Use It might also be interesting to distinguish our results between the type of twins. I zyg = Fraternal/Identical Twin Indicator I Monozygotic (identical) = 1 I Dizygotic (fraternal) = 2 I categorical , explanatory variable
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help
Effects of Tobacco Use Before we can create a graphical description, we need to add the two variables of interest ( difference in tobacco use and difference in lumbar spine BMD ) to our data set. # Difference in tobacco use bd$diff_tob_use <- bd$pyr2 - bd$pyr1
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help
Effects of Tobacco Use Before we can create a graphical description, we need to add the two variables of interest ( difference in tobacco use and difference in lumbar spine BMD ) to our data set. # Difference in tobacco use bd$diff_tob_use <- bd$pyr2 - bd$pyr1 # Difference in lumbar spine BMD bd$diff_ls <- (bd$ls2 - bd$ls1)/ mean ( c (bd$ls2, bd$ls1)) * 100
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help
Effects of Tobacco Use Always check to make sure you added variables in appropriately. head (bd, 3 ) ## ID age zyg ht1 wt1 tea1 cof1 alc1 cur1 men1 pyr1 ## 1 1002501 27 2 162 57 35 0 1 1 0 0 ## 2 1015401 42 2 165 76 42 2 3 5 1 0 ## 3 1027601 59 2 150 114 12 0 0 0 1 0 ## wt2 tea2 cof2 alc2 cur2 men2 pyr2 ls2 fn2 fs2 diff ## 1 56 42 21 0 0 0 13.75 0.76 0.68 1.04 ## 2 72 20 21 1 1 0 48.00 0.89 0.64 1.11 ## 3 54 7 28 0 0 1 20.50 0.51 0.64 0.86
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help
Effects of Tobacco Use Since we are comparing 2 quantitative variables, let’s make a scatterplot. xyplot (diff_ls ~ diff_tob_use, data = bd) -Pair Differences in Bone Density of Lumbar Difference in BMD (%) -30 -20 -10 0 10 20 10 20 30 40 50 60
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help
Effects of Tobacco Use Adding a horizontal line at y = 0 might help! -Pair Differences in Bone Density of Lumbar Difference in Tobacco-Use (pack-years) Difference in BMD (%) -30 -20 -10 0 10 20 10 20 30 40 50 60
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help
Effects of Tobacco Use It might be informative to distinguish between fraternal and identical twins. xyplot (diff_ls ~ diff_tob_use, groups = zyg, data = bd, auto.key = TRUE ) -Pair Differences in Bone Density of Lumbar Difference in BMD (%) -30 -20 -10 0 10 20 10 20 30 40 50 60 1 2
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help
Effects of Tobacco Use Research Question: How does tobacco use affect within-pair differences of BMD at the lumbar spine? Conclusion: Virtually all the differences in BMD are below 0, especially for twins with large differences in tobacco use ( 30 pack-years). This indicates that the heavier-smoking twin had a lower BMD than the lighter-smoking twin.
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help