Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
Research Methods I Final
Language:
Ada
Assembly
Bash
C#
C++ (gcc)
C++ (clang)
C++ (vc++)
C (gcc)
C (clang)
C (vc)
Client Side
Clojure
Common Lisp
D
Elixir
Erlang
F#
Fortran
Go
Haskell
Java
Javascript
Kotlin
Lua
MySql
Node.js
Ocaml
Octave
Objective-C
Oracle
Pascal
Perl
Php
PostgreSQL
Prolog
Python
Python 3
R
Rust
Ruby
Scala
Scheme
Sql Server
Swift
Tcl
Visual Basic
Layout:
Vertical
Horizontal
# Ludy Thenor # John Jay College # Final Exam #BIVARIATE REGRESSION (Answers to Questions 9-16 Annotated Below) # Data Set 1 x <-c(8, 12.5, 15, 10) y <-c(2, 7, 8, 3) n <- length(x) mean(x) # 11.375 mean(y) # 5 b1 <- cov(x,y)/var(x) # estimated x1-coefficient (slope) b0 <- mean(y) - b1 * mean(x) # estimated y-intercept yhat <- b0 + b1 * (x) # predicted y value uhat <- y - yhat # residual b1 # 0.93905192 mean(y) - -5.681 * mean(x) # - 0.9391 b0 # -5.6817156 yhat # 1.83069976 6.0564334 8.40406334 3.7088036 uhat # .17 .94 -.40 -.71 ess <- sum((yhat - mean(y))^2) # expected sum of squares rss <- sum((y - yhat)^2) # residual sum of squares tss <- sum((y - mean(y))^2) # total sum of squares r2 <- (ess/tss) # correlation coefficient ser <- (sqrt(rss / (n-2))) # standard error fstat <- (ess / (rss / (n-2))) # F-statistic ess # 24.3966 rss # 1.5766 tss # 26 r2 # 0.93833077 ser # 0.88786260198 fstat # 30.81 lm(formula = y ~ x) summary(lm(formula = y ~ x))
[
+
]
Show input
Absolute running time: 0.33 sec, cpu time: 0.63 sec, memory peak: 32 Mb, absolute service time: 0,33 sec
edit mode
|
history
|
discussion