Friday, September 30, 2011

Assignment 1 of Webbook about Linear Regression from UCLA ATS

These questions are from the webbook 'Regression of Stata' of ucla ats. The original questions require to use Stata to answer. Here I try to use SAS to answer these question.


                                                                                   Linear Regression

Question 1:  Use data set elemapi2. Make five graphs of api99: histogram, kdensity plot, boxplot, symmetry plot and normal quantile plot.
Answer 1:
1:histogram / kernel density / normal density

2: kernel density


3: boxplot



4: QQ plot


5: normal probability plot



Question 2: What is the correlation between api99 and meals

Answer 2:

          
From the output we can see the correlation of api99 and meals is negative, the value is -.908. That is, as the percentage of free meals increase, the api99 value will decrease.

Question 3: Regress api99 on meals. What does the output tell you?

Answer 3:


p-value is < .0001, that is, meals is significant in the regression. the coefficient is negative which means as meals increase by one unit, the value of api99 will decrease by 4.187.

Question 4: Create and list the fitted (predicted) values

Answer 4: 
The first 20 predict values are



Question 5: Graph meals and api99 with and without the regression line.

Answer 5: 
With Regression Line:

Without Regression Line (in SAS, with / noline after model statement)


Question 6: Look at the correlations among the variables api99 meals ell avg_ed using the corr command. Explain how these commands are different. Make a scatterplot matrix for these variables and relate the correlation results to the scatterplot matrix.

Answer 6: 
Correlation of the variables

Scatter Plot of the variables. It gives virtual representation of the correlation of the variables. api99 is positively correlated with avg_ed and negatively with meals and ell.


Question 7: Perform a regression predicting api99 from meals and ell. Interpret the output. 

Answer 7:

From p-value it shows these predictors are significant. Also, it verifies the negative relation of api99 with meals and ell while positive with avg_ed.

No comments:

Post a Comment