phit

School scores

This example fits a linear regression of test score on study hours and prior score. The data has 250 students from 12 schools and is stored in this app's database. Each change to the predictors refits the model on the server with phit.

Code

$fit = DataFrame::fromQuery(StudentScore::query()) |>
    lm('score ~ study_hours + prior_score');
$fit = phplyr(DataFrame::fromQuery(StudentScore::query()))
    ->lm('score ~ study_hours + prior_score');
Predictors
Term Estimate Std. error t p 95% CI
(Intercept) 45.3014 2.3222 19.51 < 0.0001 [40.727, 49.875]
Study hours 1.5691 0.2054 7.64 < 0.0001 [1.165, 1.974]
Prior score 0.2730 0.0530 5.15 < 0.0001 [0.168, 0.377]

n = 250, R² = 0.5972, adjusted R² = 0.5940, residual SD = 6.572.