Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # generate some data:
- at=5;bt=3.5;ct=2
- er=rnorm(50,0,0.5)
- x=rep(1:10,each=5)
- y=rep(2:6,times=10)
- z=runif(50,3,13)
- f=a+bt*x+ct*y+bt*ct*z+er
- x y z f
- 1 2 4.41772 43.13881
- 1 3 3.27877 37.86786
- 1 4 11.72467 98.11645
- 1 5 12.89926 108.31700
- 1 6 12.70191 109.26653
- 2 2 5.56601 53.74264
- 2 3 7.51415 69.91123
- 2 4 3.29666 43.43002
- 2 5 10.48299 95.09565
- 2 6 12.97598 113.94662
- 3 2 11.01474 96.14735
- 3 3 6.45463 66.72930
- 3 4 7.29405 73.81140
- 3 5 4.66598 59.69668
- 3 6 10.73396 102.12973
- 4 2 4.75961 56.11710
- 4 3 5.25630 61.94787
- 4 4 5.31457 64.68823
- 4 5 9.02318 92.40222
- 4 6 5.85377 72.45057
- 5 2 5.19293 62.11454
- 5 3 5.85723 69.51613
- 5 4 4.48740 62.66245
- 5 5 11.15931 110.75395
- 5 6 7.90122 90.20729
- 6 2 7.48214 82.41067
- 6 3 5.11017 68.06972
- 6 4 11.08377 111.01008
- 6 5 7.91120 91.51254
- 6 6 11.57816 119.30712
- 7 2 9.69650 102.06396
- 7 3 11.13549 113.36050
- 7 4 11.41179 117.03492
- 7 5 12.72066 127.97719
- 7 6 8.66705 102.38321
- 8 2 6.50427 82.27634
- 8 3 5.92371 79.93017
- 8 4 9.89270 110.24138
- 8 5 9.12479 107.29101
- 8 6 12.87875 134.94524
- 9 2 9.41497 106.09548
- 9 3 8.71814 103.16074
- 9 4 8.89625 106.66582
- 9 5 3.51514 71.61044
- 9 6 10.43254 121.21656
- 10 2 7.32917 94.60507
- 10 3 10.70345 121.05722
- 10 4 4.34320 78.78394
- 10 5 10.92676 126.43769
- 10 6 9.90614 121.39587
- lm(f~x+y+z)
- (Intercept) x y z
- 4.930 3.529 2.162 6.903
- nlsfit = nls(f~a+b*x+c*y+b*c*z,start=list(a=4.9,b=3.5,c=2.1))
- Formula: f ~ a + b * x + c * y + b * c * z
- Parameters:
- Estimate Std. Error t value Pr(>|t|)
- a 5.37481 0.23287 23.08 <2e-16 ***
- b 3.50528 0.02278 153.89 <2e-16 ***
- c 1.98310 0.01408 140.82 <2e-16 ***
- ---
- Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
- Residual standard error: 0.4798 on 47 degrees of freedom
- Number of iterations to convergence: 3
- Achieved convergence tolerance: 6.281e-07
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement