Advertisement
Guest User

Untitled

a guest
Feb 14th, 2016
63
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.26 KB | None | 0 0
  1. # generate some data:
  2. at=5;bt=3.5;ct=2
  3. er=rnorm(50,0,0.5)
  4. x=rep(1:10,each=5)
  5. y=rep(2:6,times=10)
  6. z=runif(50,3,13)
  7. f=a+bt*x+ct*y+bt*ct*z+er
  8.  
  9. x y z f
  10. 1 2 4.41772 43.13881
  11. 1 3 3.27877 37.86786
  12. 1 4 11.72467 98.11645
  13. 1 5 12.89926 108.31700
  14. 1 6 12.70191 109.26653
  15. 2 2 5.56601 53.74264
  16. 2 3 7.51415 69.91123
  17. 2 4 3.29666 43.43002
  18. 2 5 10.48299 95.09565
  19. 2 6 12.97598 113.94662
  20. 3 2 11.01474 96.14735
  21. 3 3 6.45463 66.72930
  22. 3 4 7.29405 73.81140
  23. 3 5 4.66598 59.69668
  24. 3 6 10.73396 102.12973
  25. 4 2 4.75961 56.11710
  26. 4 3 5.25630 61.94787
  27. 4 4 5.31457 64.68823
  28. 4 5 9.02318 92.40222
  29. 4 6 5.85377 72.45057
  30. 5 2 5.19293 62.11454
  31. 5 3 5.85723 69.51613
  32. 5 4 4.48740 62.66245
  33. 5 5 11.15931 110.75395
  34. 5 6 7.90122 90.20729
  35. 6 2 7.48214 82.41067
  36. 6 3 5.11017 68.06972
  37. 6 4 11.08377 111.01008
  38. 6 5 7.91120 91.51254
  39. 6 6 11.57816 119.30712
  40. 7 2 9.69650 102.06396
  41. 7 3 11.13549 113.36050
  42. 7 4 11.41179 117.03492
  43. 7 5 12.72066 127.97719
  44. 7 6 8.66705 102.38321
  45. 8 2 6.50427 82.27634
  46. 8 3 5.92371 79.93017
  47. 8 4 9.89270 110.24138
  48. 8 5 9.12479 107.29101
  49. 8 6 12.87875 134.94524
  50. 9 2 9.41497 106.09548
  51. 9 3 8.71814 103.16074
  52. 9 4 8.89625 106.66582
  53. 9 5 3.51514 71.61044
  54. 9 6 10.43254 121.21656
  55. 10 2 7.32917 94.60507
  56. 10 3 10.70345 121.05722
  57. 10 4 4.34320 78.78394
  58. 10 5 10.92676 126.43769
  59. 10 6 9.90614 121.39587
  60.  
  61. lm(f~x+y+z)
  62.  
  63. (Intercept) x y z
  64. 4.930 3.529 2.162 6.903
  65.  
  66. nlsfit = nls(f~a+b*x+c*y+b*c*z,start=list(a=4.9,b=3.5,c=2.1))
  67.  
  68. Formula: f ~ a + b * x + c * y + b * c * z
  69.  
  70. Parameters:
  71. Estimate Std. Error t value Pr(>|t|)
  72. a 5.37481 0.23287 23.08 <2e-16 ***
  73. b 3.50528 0.02278 153.89 <2e-16 ***
  74. c 1.98310 0.01408 140.82 <2e-16 ***
  75. ---
  76. Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
  77.  
  78. Residual standard error: 0.4798 on 47 degrees of freedom
  79.  
  80. Number of iterations to convergence: 3
  81. Achieved convergence tolerance: 6.281e-07
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement