6. 6 . <- Add Extra Rows with Missing Dependent Variable

Total Page:16

File Type:pdf, Size:1020Kb

6. 6 . <- Add Extra Rows with Missing Dependent Variable

. list

+------+ | var1 var2 | |------| 1. | 1 2 | 2. | 2 3 | 3. | 3 3 | 4. | 4 7 | 5. | 5 10 | |------| 6. | 6 . |<- add extra rows with missing dependent variable 7. | 7 . |<- estimates, predictions and standard errors will be computed for +------+<- each value of ‘var1’ using the model with the complete data

. regr var2 var1

Source | SS df MS Number of obs = 5 ------+------F( 1, 3) = 20.00 Model | 40 1 40 Prob > F = 0.0208 Residual | 6 3 2 R-squared = 0.8696 ------+------Adj R-squared = 0.8261 Total | 46 4 11.5 Root MSE = 1.4142

------var2 | Coef. Std. Err. t P>|t| [95% Conf. Interval] ------+------var1 | 2 .4472136 4.47 0.021 .5767667 3.423233 _cons | -1 1.48324 -0.67 0.548 -5.720331 3.720331 ------

. predict yhat (option xb assumed; fitted values)

. predict see,stdp <- the stdp option computes standard error of estimation (for CIs)

. predict sep,stdf <- the stdf option computes standard error of prediction (for PIs)

. list

+------+ | var1 var2 yhat see sep | |------| 1. | 1 2 1 1.095445 1.788854 | 2. | 2 3 3 .7745967 1.612452 | 3. | 3 3 5 .6324555 1.549193 | 4. | 4 7 7 .7745967 1.612452 | 5. | 5 10 9 1.095445 1.788854 | |------| 6. | 6 . 11 1.48324 2.04939 | 7. | 7 . 13 1.897367 2.366432 | +------+ . insheet using "C:\Mdsc643.01\Fall 2003\sleuth\CASE0802.csv" (3 vars, 76 obs)

. desc

Contains data obs: 76 vars: 3 size: 1,216 (99.9% of memory free) ------storage display value variable name type format label variable label ------time float %9.0g TIME voltage byte %8.0g VOLTAGE group str7 %9s GROUP ------Sorted by: Note: dataset has changed since last saved

. encode group,gen(gr)

. regr time voltage

Source | SS df MS Number of obs = 76 ------+------F( 1, 74) = 24.27 Model | 2150408.26 1 2150408.26 Prob > F = 0.0000 Residual | 6557345.28 74 88612.774 R-squared = 0.2470 ------+------Adj R-squared = 0.2368 Total | 8707753.53 75 116103.38 Root MSE = 297.68

------time | Coef. Std. Err. t P>|t| [95% Conf. Interval] ------+------voltage | -53.95492 10.95264 -4.93 0.000 -75.77853 -32.13131 _cons | 1886.169 364.4812 5.17 0.000 1159.925 2612.414 ------

. browse

. onew time gr

Analysis of Variance Source SS df MS F Prob > F ------Between groups 5082509.89 6 847084.982 16.12 0.0000 Within groups 3625243.64 69 52539.7629 ------Total 8707753.53 75 116103.38

Bartlett's test for equal variances: chi2(6) = 299.5126 Prob>chi2 = 0.000

. gen lt=log(time)

. one lt group

Analysis of Variance Source SS df MS F Prob > F ------Between groups 196.477407 6 32.7462344 13.00 0.0000 Within groups 173.748925 69 2.51810036 ------Total 370.226332 75 4.93635109

Bartlett's test for equal variances: chi2(6) = 14.6789 Prob>chi2 = 0.023 . regr lt voltage

Source | SS df MS Number of obs = 76 ------+------F( 1, 74) = 78.14 Model | 190.151492 1 190.151492 Prob > F = 0.0000 Residual | 180.07484 74 2.43344378 R-squared = 0.5136 ------+------Adj R-squared = 0.5070 Total | 370.226332 75 4.93635109 Root MSE = 1.5599

------lt | Coef. Std. Err. t P>|t| [95% Conf. Interval] ------+------voltage | -.5073649 .057396 -8.84 0.000 -.6217289 -.393001 _cons | 18.95546 1.910019 9.92 0.000 15.14966 22.76125 ------

. anova lt voltage gr,continuous(voltage) sequential

Number of obs = 76 R-squared = 0.5307 Root MSE = 1.58685 Adj R-squared = 0.4899

Source | Seq. SS df MS F Prob > F ------+------Model | 196.477407 6 32.7462344 13.00 0.0000 | voltage | 190.151492 1 190.151492 75.51 0.0000 <- gr | 6.32591472 5 1.26518294 0.50 0.7734 <- | Residual | 173.748925 69 2.51810036 <- best estimate of variance ------+------Total | 370.226332 75 4.93635109

.

Recommended publications