Previous Page | Next Page

Adding Curves to Plots

Adding Curves to Plots



In previous chapters you learned how to open a data set and how to call a SAS procedure by using the SUBMIT and ENDSUBMIT statements. You learned how to read output variable from the server into the DataObject. This chapter shows you how to add lines and curves to a graph to visualize a model's fit.

The program statements in this chapter are distributed with Stat Studio. To open the program containing the statements:

  1. Select File \blacktriangleright\,Open \blacktriangleright\,File from the main menu.
  2. Click Go to Installation directory near the bottom of the dialog box.
  3. Navigate to the Programs\Doc\STATGuide folder.
  4. Select the Fit.sx file.
  5. Click Open.

In Chapter 5, "Adding Variables to the DataObject," you created a residual plot. In this chapter you also create a scatter plot of the independent and dependent variables that shows the model's predicted values and the upper and lower 95% limits for individual predictions. The REG procedure outputs the predicted values with the P= option in the MODEL statement, and the upper and lower prediction limits with the LCL= and UCL= options.

Type or copy the following statements into a program window.

  
 declare DataObject dobj; 
 dobj = DataObject.CreateFromFile("Hurricanes"); 
  
 dobj.WriteVarsToServerDataSet( {"wind_kts" "min_pressure"}, 
    "work", "Hurr", true ); 
  
 submit; 
 proc reg data=Hurr; 
    model wind_kts = min_pressure; 
    output out=RegOut P=Pred R=Residual LCL=LCL UCL=UCL; 
 run; 
 endsubmit; 
  
 ok = CopyServerDataToDataObject( "work", "RegOut", dobj, 
    {"Pred" "Residual" "LCL" "UCL"}, /* names on server */ 
    {"Pred" "Residual" "LCL" "UCL"}, /* names in DataObject */ 
    {"Predicted" "Residuals" "Lower Conf. Limit" "Upper Conf. Limit"}, 
    true );
 

The first two sets of statements are explained in Chapter 2, "Reading and Writing Data." The next two sets of statements are similar to statements in the example from Chapter 5, "Adding Variables to the DataObject."

Whenever you want to add a line or curve to a plot, you need to specify the following:

These aspects are discussed in the Stat Studio online Help.


Drawing a Reference Line

Drawing a Curve from Variables in the DataObject

Drawing a Curve from Variables in a Data Set

Previous Page | Next Page | Top of Page