galileo                package:UsingR                R Documentation

_G_a_l_i_l_e_o _d_a_t_a _o_n _f_a_l_l_i_n_g _b_o_d_i_e_s

_D_e_s_c_r_i_p_t_i_o_n:

     Data recorded by Galileo in 1609 during his investigations of the
     trajectory of a falling body.

_U_s_a_g_e:

     data(galileo)

_F_o_r_m_a_t:

     A data frame with 7 observations on the following 2 variables.

     _i_n_i_t._h Initial height of ball

     _h._d Horizontal distance traveled

_D_e_t_a_i_l_s:

     A simple ramp 500 punti above the ground was constructed. A ball
     was placed on the ramp at an indicated height from the ground and
     released. The horizontal distance traveled is recorded (in punti).
     (One punto is 169/180 millimeter, not a car by FIAT.)

_S_o_u_r_c_e:

     This data and example come from the _Statistical Sleuth_ by Ramsay
     and Schafer, Duxbury (2001), section 10.1.1. They attribute an
     article in _Scientific American_ by Drake and MacLachlan.

_E_x_a_m_p_l_e_s:

     data(galileo)
     polynomial = function(x,coefs) {
       sum = 0
       for(i in 0:(length(coefs)-1)) {
         sum = sum + coefs[i+1]*x^i
       }
       sum
     }
     res.lm = lm(h.d ~ init.h, data = galileo)
     res.lm2 = update(res.lm, . ~ . + I(init.h^2), data=galileo)
     res.lm3 = update(res.lm2, . ~ . + I(init.h^3), data=galileo)
     plot(h.d ~ init.h, data = galileo)
     curve(polynomial(x,coef(res.lm)),add=TRUE)
     curve(polynomial(x,coef(res.lm2)),add=TRUE)
     curve(polynomial(x,coef(res.lm3)),add=TRUE)

