# File: explore.php

File: explore.php Application script text/plain Script for submitting values for analysis SimpleLinearRegression Package that implements simple linear regression By Paul Meagher 12 years ago 4,913 bytes

## Contents

 ```   Simple Linear Regression

Simple Linear Regression

1. Title of Study

2. Enter X name

3. Enter comma separated X values

4. Enter Y name

5. Enter comma separated Y values

6. Confidence Interval
%

\$title";     \$slr->showTableSummary(\$x_name, \$y_name);   echo "

";     \$slr->showAnalysisOfVariance();   echo "

";   \$slr->showParameterEstimates(\$x_name, \$y_name);   echo "
";   \$slr->showFormula(\$x_name, \$y_name);   echo "

";   \$slr->showRValues(\$x_name, \$y_name);   echo "
";   include ("jpgraph/jpgraph.php");   include ("jpgraph/jpgraph_scatter.php");   include ("jpgraph/jpgraph_line.php");     // The first graph to display is a scatter plus line plot   \$graph = new Graph(300,200,'auto');   \$graph->SetScale("linlin");     // Setup title   \$graph->title->Set("\$title");   \$graph->img->SetMargin(50,20,20,40);   \$graph->xaxis->SetTitle("\$x_name","center");   \$graph->yaxis->SetTitleMargin(30);   \$graph->yaxis->title->Set("\$y_name");     \$graph->title->SetFont(FF_FONT1,FS_BOLD);     // make sure that the X-axis is always at the   // bottom at the plot and not just at Y=0 which is   // the default position   \$graph->xaxis->SetPos('min');     // Create the scatter plot with some nice colors   \$sp1 = new ScatterPlot(\$slr->Y, \$slr->X);   \$sp1->mark->SetType(MARK_FILLEDCIRCLE);   \$sp1->mark->SetFillColor("red");   \$sp1->SetColor("blue");   \$sp1->SetWeight(3);   \$sp1->mark->SetWidth(4);     // Create the regression line   \$lplot = new LinePlot(\$slr->PredictedY, \$slr->X);   \$lplot->SetWeight(2);   \$lplot->SetColor('navy');     // Add the pltos to the line   \$graph->Add(\$sp1);   \$graph->Add(\$lplot);     // ... and stroke   \$graph_name = "temp/test.png";   \$graph->Stroke(\$graph_name);   ?>

SetScale("linlin");     // Setup title   \$graph2->title->Set("\$title");   \$graph2->img->SetMargin(60,20,20,40);   \$graph2->xaxis->SetTitle("Predicted Y","center");   \$graph2->yaxis->SetTitleMargin(40);   \$graph2->yaxis->title->Set("Residual");     \$graph2->title->SetFont(FF_FONT1,FS_BOLD);   \$graph2->xaxis->SetPos('min');     \$sp2 = new ScatterPlot(\$slr->Error, \$slr->PredictedY);   \$sp2->mark->SetType(MARK_FILLEDCIRCLE);   \$sp2->mark->SetFillColor("red");   \$sp2->SetColor("blue");   \$sp2->SetWeight(3);   \$sp2->mark->SetWidth(4);     \$graph2->Add(\$sp2);     \$graph_name = "temp/test2.png";   \$graph2->Stroke(\$graph_name);   ?>
```