Multiple regression: Difference between revisions

+spss
m (→‎{{header|Raku}}: Fix comment: Perl 6 --> Raku)
(+spss)
Line 1,512:
{{out}}
<pre>Matrix[[0.9999999999999996], [2.0]]</pre>
 
=={{header|SPSS}}==
 
First, build a random dataset:
 
<lang>set rng=mc seed=17760704.
new file.
input program.
loop #i=1 to 200.
compute x1=rv.normal(0,1).
compute x2=rv.normal(0,1).
compute x3=rv.normal(0,1).
compute x4=rv.normal(0,1).
end case.
end loop.
end file.
end input program.
compute y=1.5+0.8*x1-0.7*x2+1.1*x3-1.7*x4+rv.normal(0,1).
execute.</lang>
 
Now use the regression command:
 
<lang>regression /dependent=y
/method=enter x1 x2 x3 x4.</lang>
 
{{out}}
 
<lang>Regression
Notes
|--------------------------------------------------------------------|---------------------------------------------------------------------------|
|Output Created |21-MAR-2020 23:17:33 |
|--------------------------------------------------------------------|---------------------------------------------------------------------------|
|Comments | |
|----------------------|---------------------------------------------|---------------------------------------------------------------------------|
|Input |Filter |<none> |
| |---------------------------------------------|---------------------------------------------------------------------------|
| |Weight |<none> |
| |---------------------------------------------|---------------------------------------------------------------------------|
| |Split File |<none> |
| |---------------------------------------------|---------------------------------------------------------------------------|
| |N of Rows in Working Data File |200 |
|----------------------|---------------------------------------------|---------------------------------------------------------------------------|
|Missing Value Handling|Definition of Missing |User-defined missing values are treated as missing. |
| |---------------------------------------------|---------------------------------------------------------------------------|
| |Cases Used |Statistics are based on cases with no missing values for any variable used.|
|--------------------------------------------------------------------|---------------------------------------------------------------------------|
|Syntax |regression /dependent=y /method=enter x1 x2 x3 x4. |
|----------------------|---------------------------------------------|---------------------------------------------------------------------------|
|Resources |Processor Time |00:00:00,00 |
| |---------------------------------------------|---------------------------------------------------------------------------|
| |Elapsed Time |00:00:00,00 |
| |---------------------------------------------|---------------------------------------------------------------------------|
| |Memory Required |4080 bytes |
| |---------------------------------------------|---------------------------------------------------------------------------|
| |Additional Memory Required for Residual Plots|0 bytes |
|------------------------------------------------------------------------------------------------------------------------------------------------|
 
Variables Entered/Removeda
|-----|-----------------|-----------------|------|
|Model|Variables Entered|Variables Removed|Method|
|-----|-----------------|-----------------|------|
|1 |x4, x3, x2, x1b |. |Enter |
|------------------------------------------------|
a Dependent Variable: y
b All requested variables entered.
 
Model Summary
|-----|-----|--------|-----------------|--------------------------|
|Model|R |R Square|Adjusted R Square|Std. Error of the Estimate|
|-----|-----|--------|-----------------|--------------------------|
|1 |,929a|,863 |,860 |,94928 |
|-----------------------------------------------------------------|
a Predictors: (Constant), x4, x3, x2, x1
 
ANOVAa
|----------------|--------------|---|-----------|-------|-----|
|Model |Sum of Squares|df |Mean Square|F |Sig. |
|-----|----------|--------------|---|-----------|-------|-----|
|1 |Regression|1106,659 |4 |276,665 |307,021|,000b|
| |----------|--------------|---|-----------|-------|-----|
| |Residual |175,720 |195|,901 | | |
| |----------|--------------|---|-----------|-------|-----|
| |Total |1282,379 |199| | | |
|-------------------------------------------------------------|
a Dependent Variable: y
b Predictors: (Constant), x4, x3, x2, x1
 
Coefficientsa
|----------------|--------------------------------------|-------------------------|-------|----|
|Model |Unstandardized Coefficients |Standardized Coefficients|t |Sig.|
| |---------------------------|----------|-------------------------| | |
| |B |Std. Error|Beta | | |
|-----|----------|---------------------------|----------|-------------------------|-------|----|
|1 |(Constant)|1,550 |,067 | |23,003 |,000|
| |----------|---------------------------|----------|-------------------------|-------|----|
| |x1 |,831 |,062 |,360 |13,457 |,000|
| |----------|---------------------------|----------|-------------------------|-------|----|
| |x2 |-,604 |,075 |-,215 |-8,051 |,000|
| |----------|---------------------------|----------|-------------------------|-------|----|
| |x3 |1,098 |,065 |,451 |16,989 |,000|
| |----------|---------------------------|----------|-------------------------|-------|----|
| |x4 |-1,770 |,073 |-,656 |-24,306|,000|
|----------------------------------------------------------------------------------------------|
a Dependent Variable: y</lang>
 
=={{header|Stata}}==
1,336

edits