User Tools

Site Tools


estimated_standard_deviation

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
estimated_standard_deviation [2026/03/10 05:28] – [output] hkimscilestimated_standard_deviation [2026/03/11 01:56] (current) – [실험적, R에서 시뮬레이션으로 이해] hkimscil
Line 57: Line 57:
 ====== 실험적, R에서 시뮬레이션으로 이해 ====== ====== 실험적, R에서 시뮬레이션으로 이해 ======
 아래 output의 코멘트를 읽을 것 아래 output의 코멘트를 읽을 것
 +<tabbox rs01>
 <code> <code>
 rm(list=ls()) rm(list=ls())
Line 136: Line 137:
 vs[min.pos.msrs] vs[min.pos.msrs]
 </code> </code>
-===== output =====+<tabbox ro01>
 <WRAP group> <WRAP group>
-<WRAP half column>+<WRAP column 55%>
 <code> <code>
 > rm(list=ls()) > rm(list=ls())
Line 165: Line 166:
 </code> </code>
 </WRAP> </WRAP>
-<WRAP half column>+<WRAP column 35%>
 SS = sum(x-mean(x))^2 인데, mean(x)을 즉, x집합의 평균을, x 원소값을 예측하는데 (빼는데) 사용하면 SS값이 최소값이 된다고 하였다. 이것을 R에서 simulation으로 알아보기 위해서 mean(x) 대신에 다른 숫자들을 넣어보려고 한다. 이를 v라고 하면 sum(x-v)^2이라는 SS값들을 구해서 비교하려는 것이다. 대입할 숫자들은 (v) mean(x) +- 3 sd(x) 를 범위로 하고, 그 범위의 시작 숫자에서 (시작은 mean(x)-3sd(x)가 된다) 0.1씩 증가시키면서 대입하고, 각 숫자마다 (처음 숫자는 35, 다음 숫자는 35.1 . . . ) SS값을 구해서 저장하여 그것을 그래프로 그려보고 최소값이 어떤 것인지 보는 것이 진행하려는 작업이다.  SS = sum(x-mean(x))^2 인데, mean(x)을 즉, x집합의 평균을, x 원소값을 예측하는데 (빼는데) 사용하면 SS값이 최소값이 된다고 하였다. 이것을 R에서 simulation으로 알아보기 위해서 mean(x) 대신에 다른 숫자들을 넣어보려고 한다. 이를 v라고 하면 sum(x-v)^2이라는 SS값들을 구해서 비교하려는 것이다. 대입할 숫자들은 (v) mean(x) +- 3 sd(x) 를 범위로 하고, 그 범위의 시작 숫자에서 (시작은 mean(x)-3sd(x)가 된다) 0.1씩 증가시키면서 대입하고, 각 숫자마다 (처음 숫자는 35, 다음 숫자는 35.1 . . . ) SS값을 구해서 저장하여 그것을 그래프로 그려보고 최소값이 어떤 것인지 보는 것이 진행하려는 작업이다. 
  
Line 174: Line 175:
  
 <WRAP group> <WRAP group>
-<WRAP half column>+<WRAP column 55%>
 <code> <code>
 > x.span <- seq(from = mean(x)-3*sd(x),  > x.span <- seq(from = mean(x)-3*sd(x), 
Line 216: Line 217:
 </code> </code>
 </WRAP> </WRAP>
-<WRAP half column>+<WRAP column 35%>
 x-mean(x) = residual = error  x-mean(x) = residual = error 
 sum(residual^2) = SS (sum of square) sum(residual^2) = SS (sum of square)
Line 228: Line 229:
  
 <WRAP group> <WRAP group>
-<WRAP half column>+<WRAP column 55%>
 <code> <code>
  
Line 252: Line 253:
 </code> </code>
 </WRAP> </WRAP>
-<WRAP half column>+<WRAP column 35%>
   * 이 후 쓸 function들. (x-v) = residual이라고 부르니까 이 residual을 모으는 function   * 이 후 쓸 function들. (x-v) = residual이라고 부르니까 이 residual을 모으는 function
   * function ssr = x 집합과 v값 (x.span의 한 숫자)를 인수를 주었을 때 구할 수 있는 Sum of Square값들 (실제로는 사용하지 않는다. 대신 msr 펑션으로 MS값을 구한다).   * function ssr = x 집합과 v값 (x.span의 한 숫자)를 인수를 주었을 때 구할 수 있는 Sum of Square값들 (실제로는 사용하지 않는다. 대신 msr 펑션으로 MS값을 구한다).
Line 260: Line 261:
  
 <WRAP group> <WRAP group>
-<WRAP half column>+<WRAP column 55%>
 <code> <code>
 > ssrs <- c() # sum of square residuals > ssrs <- c() # sum of square residuals
Line 285: Line 286:
 </code> </code>
 </WRAP> </WRAP>
-<WRAP half column>+ 
 +<WRAP column 35%>
 comment comment
   * x.span의 처음값인 35.1을 넣어서 (x-v)를 구한 후    * x.span의 처음값인 35.1을 넣어서 (x-v)를 구한 후 
Line 302: Line 304:
  
 <WRAP group> <WRAP group>
-<WRAP half column>+<WRAP column 55%>
 <code> <code>
 > # v값이 x.span에 따라서 변화하여 대입되었을 때의 > # v값이 x.span에 따라서 변화하여 대입되었을 때의
Line 372: Line 374:
 </code> </code>
 </WRAP> </WRAP>
-<WRAP half column>+<WRAP column 35%>
 comment comment
   * msrs값에 저장된 msr값들 (mean square residual값들) 중에서   * msrs값에 저장된 msr값들 (mean square residual값들) 중에서
Line 382: Line 384:
  
 <WRAP group> <WRAP group>
-<WRAP half column>+<WRAP column 55%>
 <code> <code>
 > # 아래는 위에서 계산한 msr 값들을 저장한 msrs값들 중에서 최소값이 되는 것을 찾은  > # 아래는 위에서 계산한 msr 값들을 저장한 msrs값들 중에서 최소값이 되는 것을 찾은 
Line 408: Line 410:
 </code> </code>
 </WRAP> </WRAP>
-<WRAP half column>+<WRAP column 35%>
 comment comment
   * msrs 의 min(msrs)값을 찾는다 24.975   * msrs 의 min(msrs)값을 찾는다 24.975
Line 420: Line 422:
 </WRAP> </WRAP>
  
 +
 +</tabbox>
 +
 +
 +===== 미분으로 기울기가 최소값이 될 때를 찾는 법 =====
  
 다음으로 MS값을 구하는 식인  다음으로 MS값을 구하는 식인 
Line 457: Line 464:
  
  
-===== output ===== 
 그렇다면  왜 n-2 혹은 n-(1/2)가 아니고  n-1인가? 이를 수학적인 증명을 통해서 살펴보면 다음 장과 같다. 그렇다면  왜 n-2 혹은 n-(1/2)가 아니고  n-1인가? 이를 수학적인 증명을 통해서 살펴보면 다음 장과 같다.
  
estimated_standard_deviation.1773120520.txt.gz · Last modified: by hkimscil

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki