Question

In: Math

I need the code in SAS and R and outputs please 2. The data below come...

I need the code in SAS and R and outputs please

2. The data below come from a study investigating a method of measuring body composition, and give the body fat percentage (% fat), age and sex for 18 adults aged between 23 and 61 years. Source: Mazess, R.B., Peppler, W.W., and Gibbons, M. (1984) Total body composition by dual-photon (153GD) absorptiometry. American Journal of Clinical Nutrition, 40, 834-839.

age % fat sex
23 9.5 male
23 27.9 female
27 7.8 male
27 17.8 male
39 31.4 female
41 25.9 female
45 27.4 male
49 25.2 female
50 31.1 female
53 34.7 female
53 42.0 female
54 29.1 female
56 32.5 female
57 30.3 female
58 33.0 female
58 33.8 female
60 41.1 female
61 34.5 female

a Enter the data into SAS using a DATALINES statement in the DATA step. Use PROC PRINT to print the resulting data set. Report your output.

b Create a data frame in R for the body composition data (from part a). Print the data frame and report the output.

Solutions

Expert Solution

(a) SAS code:

data mydata;
input age fat sex$;
datalines;
23 9.5 male
23 27.9 female
27 7.8 male
27 17.8 male
39 31.4 female
41 25.9 female
45 27.4 male
49 25.2 female
50 31.1 female
53 34.7 female
53 42.0 female
54 29.1 female
56 32.5 female
57 30.3 female
58 33.0 female
58 33.8 female
60 41.1 female
61 34.5 female
;
run;
proc print data=mydata;
run;

SAS-OUTPUT:

Obs age fat sex
1 23 9.5 male
2 23 27.9 female
3 27 7.8 male
4 27 17.8 male
5 39 31.4 female
6 41 25.9 female
7 45 27.4 male
8 49 25.2 female
9 50 31.1 female
10 53 34.7 female
11 53 42.0 female
12 54 29.1 female
13 56 32.5 female
14 57 30.3 female
15 58 33.0 female
16 58 33.8 female
17 60 41.1 female
18 61 34.5 female

(b) R-code:

data.frame(age=c(23,23,27,27,39,41,45,49,50,53,53,54,56,57,58,58,60,61),fat=c(9.5,27.9,7.8,17.8,31.4,25.9,27.4,25.2,31.1,34.7,42.0,29.1,32.5,30.3,33.0,33.8,41.1,34.5),sex=c("male","female","male","male","female","female","male","female","female","female","female","female","female","female","female","female","female","female"))

R-OUTPUT:

1 23 9.5 male
2 23 27.9 female
3 27 7.8 male
4 27 17.8 male
5 39 31.4 female
6 41 25.9 female
7 45 27.4 male
8 49 25.2 female
9 50 31.1 female
10 53 34.7 female
11 53 42.0 female
12 54 29.1 female
13 56 32.5 female
14 57 30.3 female
15 58 33.0 female
16 58 33.8 female
17 60 41.1 female
18 61 34.5 female


Related Solutions

I would need both SAS & R code, the output and .txt file/s, please. Because many...
I would need both SAS & R code, the output and .txt file/s, please. Because many HMOs either do not cover mental health costs or provide only minimal coverage, min- isters and priests often need to provide counseling to persons suffering from mental illness. An in- terdenominational organization wanted to determine whether the clerics from different religions have different levels of awareness with respect to the causes of mental illness. Fifteen clerics from different Christian denominations were sampled. Each was...
Write code in SAS to do each of the following I have posted the data below...
Write code in SAS to do each of the following I have posted the data below from a pace delimited data set consisting of 66 randomly selected cars Upload the data set to SAS and store it as a SAS data set called cars. Make sure the full values are stored for all character variables. Create a comparative bar chart (with appropriate title and labels) displaying the brands of each car by fuel type (so that fuel type is on...
I need this in R code please: Use the dataset ’juul’ in package ’ISwR’ to answer...
I need this in R code please: Use the dataset ’juul’ in package ’ISwR’ to answer the question. (1) Conduct one-way ANOVA test to test if the mean of igf1 of each level of tanner are the same? (2) What is the mean of igf1 in each level of tanner? (3) If there is any difference, which ones appear to be different? (Use pairwise t test for each pair of level with bonferroni method)
Using SAS is preferred but not required. Please provide SAS code and the relevant output if...
Using SAS is preferred but not required. Please provide SAS code and the relevant output if SAS is used. •             Link to referenced FEV.CSV: https://drive.google.com/open?id=1t1CRIbnTE7xL_OE9Bmajb564RXcg8nDo For all hypothesis testing problems: •             state the null and alternative hypotheses, •             calculate the value of the test statistic, •             determine if the results are statistically significant (using rejection region or p-value approaches), •             then state your conclusion in terms of the problem. 1.            FEV (forced expiratory volume) is an index of pulmonary function...
Please type SAS code for questions below Age < 65 N = Age ≥ 65 N...
Please type SAS code for questions below Age < 65 N = Age ≥ 65 N = Total N = Sex      Male      Female Region      Northeast      Midwest      South      West Race      White      Black      Asian      All other race groups
Answer IN R CODE please. Using the data below, Create a scatterplot of y vs x...
Answer IN R CODE please. Using the data below, Create a scatterplot of y vs x (show this) and fit it a simple linear regression model using y as the response and plot the regression line (with the data). Show this as well. Test whether x is a significant predictor and create a 95% CI around the slope coefficient. What does the coefficient of determinations represent? For x=20, create a CI for E(Y|X=20). Show this. For x=150, can you use...
COMPUTER CALCULATIONS: I need to know how to code in R for the solutions, not by...
COMPUTER CALCULATIONS: I need to know how to code in R for the solutions, not by hand. 2. Look at the data in Table 7.18 on page 368 of the textbook. These data are also given in the SAS code labeled “SAS_basketball_goal_data” and R code labeled basketball goal data . The dependent variable is goals and the independent variable is height of basketball players. Complete a SAS /R program and answer the following questions about the data set: (a) Does...
USE R CODING! Pleaseee I need the code With R coding Obs: it supposed to use...
USE R CODING! Pleaseee I need the code With R coding Obs: it supposed to use probability density function like X ~ Binomial( n ,p ) dbinom(X=?, n, prob) pbinom(X=?, n, prob) rbinmo(幾個符合二項分配的X, n, prob) X~Poisson (lamda) dpois(X=?, lamda) ppois (X=?, lamda) rpois (X, lamda) **Suppose the random variable X obeys the binomial allocation B (n=100, p=0.1) (a) Use X as the binomial allocation to calculate P(12≤X≤14) (b) In practice, when np ≥ 5 and n(1-p) ≥ 5, X will...
Write a R-script to (and show the outputs of your code) (a) Create a sequence of...
Write a R-script to (and show the outputs of your code) (a) Create a sequence of numbers starting at 3.5 and ending at 10.7 with increments of 0.79. Find the variance and mean of those numbers. And finally sort the vector in a decreasing manner (b) Create a 3 different 3 by 3 matrices such that each of the numbers 1,2,...,9 appear exactly once (Sudoku style) in each of the matrices.
Need SAS code for inferred two population variance testing 2 brand of tires. N= 10 each...
Need SAS code for inferred two population variance testing 2 brand of tires. N= 10 each and alpha= 0.1 data is below Using hand calculation, there is significant evidence that there is a significant difference between the 2 variance. I need a SAS code to: reproduce the test statistics and what is the p-value for inferring 2 variances. brand I Brand II 1 38.99 2 44.6 1 39.7 2 46.9 1 42.3 2 48.7 1 39.5 2 41.5 1 39.6...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT