muscle package:MASS R Documentation _E_f_f_e_c_t _o_f _C_a_l_c_i_u_m _C_h_l_o_r_i_d_e _o_n _M_u_s_c_l_e _C_o_n_t_r_a_c_t_i_o_n _i_n _R_a_t _H_e_a_r_t_s _D_e_s_c_r_i_p_t_i_o_n: The purpose of this experiment was to assess the influence of calcium in solution on the contraction of heart muscle in rats. The left auricle of 21 rat hearts was isolated and on several occasions a constant-length strip of tissue was electrically stimulated and dipped into various concentrations of calcium chloride solution, after which the shortening of the strip was accurately measured as the response. _U_s_a_g_e: muscle _F_o_r_m_a_t: This data frame contains the following columns: '_S_t_r_i_p' which heart muscle strip was used? '_C_o_n_c' concentration of calcium chloride solution, in multiples of 2.2 mM. '_L_e_n_g_t_h' the change in length (shortening) of the strip, (allegedly) in mm. _S_o_u_r_c_e: Linder, A., Chakravarti, I. M. and Vuagnat, P. (1964) Fitting asymptotic regression curves with different asymptotes. In _Contributions to Statistics. Presented to Professor P. C. Mahalanobis _ _on the occasion of his 70th birthday,_ ed. C. R. Rao, pp. 221-228. Oxford: Pergamon Press. _R_e_f_e_r_e_n_c_e_s: Venables, W. N. and Ripley, B. D. (2002) _Modern Applied Statistics with S._ Fourth Edition. Springer. _E_x_a_m_p_l_e_s: A <- model.matrix(~ Strip - 1, data=muscle) rats.nls1 <- nls(log(Length) ~ cbind(A, rho^Conc), data = muscle, start = c(rho=0.1), algorithm="plinear") B <- coef(rats.nls1) B st <- list(alpha = B[2:22], beta = B[23], rho = B[1]) (rats.nls2 <- nls(log(Length) ~ alpha[Strip] + beta*rho^Conc, data = muscle, start = st)) attach(muscle) Muscle <- expand.grid(Conc = sort(unique(Conc)), Strip = levels(Strip)) Muscle$Yhat <- predict(rats.nls2, Muscle) Muscle <- cbind(Muscle, logLength = rep(as.numeric(NA), 126)) ind <- match(paste(Strip, Conc), paste(Muscle$Strip, Muscle$Conc)) Muscle$logLength[ind] <- log(Length) detach() require(lattice) xyplot(Yhat ~ Conc | Strip, Muscle, as.table = TRUE, ylim = range(c(Muscle$Yhat, Muscle$logLength), na.rm = TRUE), subscripts = TRUE, xlab = "Calcium Chloride concentration (mM)", ylab = "log(Length in mm)", panel = function(x, y, subscripts, ...) { lines(spline(x, y)) panel.xyplot(x, Muscle$logLength[subscripts], ...) })