Geoscience Reference
In-Depth Information
data(:,1) = 0.3 + 0.03*randn(50,1);
data(:,2) = 0.2 + 0.01*randn(50,1);
data(:,3) = 0.2 ...
- 52.0*data(:,1) ...
+ 276.0*data(:,2) ...
+ 2.4*randn(50,1);
for i = 1 : size(data,1)
samples(i,:) = [sprintf('%02.0f',i)];
end
variables = ['Var1';
'Var2';
'Var3'];
Using fitlm again
beta = fitlm(data(:,1:2),data(:,3),...
'ResponseVar',variables(3,:),...
'PredictorVars',variables(1:2,:))
we see from the output
beta =
Linear regression model:
Var3 ~ 1 + Var1 + Var2
Estimated Coefficients:
Estimate SE tStat pValue
________ ______ _______ __________
(Intercept) 5.0222 6.9235 0.72538 0.47181
Var1 -45.307 9.1424 -4.9557 9.7694e-06
Var2 239.8 33.273 7.2071 3.969e-09
Number of observations: 50, Error degrees of freedom: 47
Root Mean Squared Error: 2.41
R-squared: 0.596, Adjusted R-Squared 0.579
F-statistic vs. constant model: 34.6, p-value = 5.68e-10
that the estimates of the regression coei cients (5.0222, -45.307, and 239.8)
do not exactly match those that were used to create the synthetic data
(0.2, -52.0, and 276.0). Furthermore, the p -value of the constant model
is signii cantly higher than in the previous example, although it is still
very good, as suggested in the last line of the comments below the table.
h e p -values of the individual regression coei cient remain low, however,
suggesting that both predictor variables Var1 and Var2 contribute equally to
the response variable Var3 at a 5% signii cance level. We can again display the
results in a three-dimensional plot (Fig. 9.8)
Search WWH ::




Custom Search