--drop table 煙 create table 煙 ( 糾 int , 蟆一 int , int ); insert 煙 values (85, 3, 65) , (74, 7, 50) , (76, 5, 55) , (90, 1, 65) , (85, 3, 55) , (87, 3, 70) , (94, 1, 65) , (98, 2, 70) , (81, 4, 55) , (91, 2, 70) , (76, 3, 50) , (74, 4, 55);
> # SQL Server 2008 磯 R貊: れ蠏覿 > library("TSodbc") > con <-odbcConnect(dsn = "sql2008") > options(TSconnection = con) > #襷 一危郁 襷る select * from 煙 tablesample(1 percent) 螳 襷 . > result = try(dbGetQuery(con, paste("SELECT 糾, , 蟆一 FROM 煙"))) > model = lm(糾 ~ + 蟆一, result) > summary(model) Call: lm(formula = 糾 ~ + 蟆一, data = result) Residuals: Min 1Q Median 3Q Max -5.348 -2.274 -1.276 2.954 5.673 Coefficients: Estimate Std. Error t value Pr(>|t|) (Intercept) 53.6832 14.1808 3.786 0.00431 ** 0.6073 0.1984 3.062 0.01353 * 蟆一 -1.9346 0.9144 -2.116 0.06348 . --- Signif. codes: 0 *** 0.001 ** 0.01 * 0.05 . 0.1 1 Residual standard error: 3.721 on 9 degrees of freedom Multiple R-squared: 0.8289, Adjusted R-squared: 0.7909 F-statistic: 21.8 on 2 and 9 DF, p-value: 0.0003544 > anova(model) #, 螻燕, 螻燕蠏 F螳, Analysis of Variance Table Response: 糾 Df Sum Sq Mean Sq F value Pr(>F) 1 541.69 541.69 39.1297 0.0001487 *** 蟆一 1 61.97 61.97 4.4762 0.0634803 . Residuals 9 124.59 13.84 --- Signif. codes: 0 *** 0.001 ** 0.01 * 0.05 . 0.1 1 > dbDisconnect(con) [1] TRUE > options(TSconnection = NULL) > odbcCloseAll() >
> summary(model) Call: lm(formula = 糾 ~ + 蟆一, data = result) Residuals: Min 1Q Median 3Q Max -5.348 -2.274 -1.276 2.954 5.673 Coefficients: Estimate Std. Error t value Pr(>|t|) (Intercept) 53.6832 14.1808 3.786 0.00431 ** 0.6073 0.1984 3.062 0.01353 * 蟆一 -1.9346 0.9144 -2.116 0.06348 . --- Signif. codes: 0 *** 0.001 ** 0.01 * 0.05 . 0.1 1 Residual standard error: 3.721 on 9 degrees of freedom Multiple R-squared: 0.8289, Adjusted R-squared: 0.7909 F-statistic: 21.8 on 2 and 9 DF, p-value: 0.0003544
> anova(model) #, 螻燕, 螻燕蠏 F螳, Analysis of Variance Table Response: 糾 Df Sum Sq Mean Sq F value Pr(>F) 1 541.69 541.69 39.1297 0.0001487 *** 蟆一 1 61.97 61.97 4.4762 0.0634803 . Residuals 9 124.59 13.84 --- Signif. codes: 0 *** 0.001 ** 0.01 * 0.05 . 0.1 1
螻燕 | 螻燕蠏 | F觜 | ||
蠏 | 603.66 | 11 | 301.83 | 21.802950 |
谿 | 124.59 | 9 | 13.84 | |
螻 | 728.25 | 11 |