nls ¤È¤¤¤¦´Ø¿ô¤¬¤¢¤ê¤Þ¤¹¡£¶ñÂÎÎã¤òµó¤²¤ÆÀâÌÀ¤·¤Þ¤·¤ç¤¦¡£
Î㡧 ɽ 1 ¤Î¤è¤¦¤Ê x¡¤y ¤Î¬ÄêÃͤËÂФ·¤Æ¡¤y = ¦Á / { 1 + ¦Â exp(-¦Ãx) } + ¦Ä ¤È¤¤¤¦´Ø¿ô¤ò¤¢¤Æ¤Ï¤á¡¤¥Ñ¥é¥á¡¼¥¿¡¤¦Á¡¤¦Â¡¤¦Ã¡¤¦Ä¤òµá¤á¤ë¡ÊƱ¤¸ÌäÂê¤ò Excel ¤Ç²ò¤¯ÊýË¡¡Ë¡£
ɽ 1. ÆóÊÑ¿ô¥Ç¡¼¥¿ x y 0 98 5 97 10 96 15 94 20 92 25 84 30 78 35 73 40 61 45 53 50 43 55 37 60 30 65 28 70 24 75 22 80 21 85 20 90 20 95 20 100 18¼ê½ç
# x ¤Ï 0 ¤«¤é»Ï¤Þ¤ê¡¤5 ¹ï¤ß¤Ç¡¤100 ¤Þ¤Ç¤Î 21 ¸Ä¤ÎÃͤò¼è¤ë > x <- seq(0,100,5) # y ¤Ï¡¤½ç¤Ë 21 ¸Ä¤ÎÃͤò¼è¤ë > y <- c(98, 97, 96, 94, 92, 84, 78, 73, 61, 53, 43, 37, 30, 28, 24, 22, 21, 20, 20, 20, 18) # ¥Ç¡¼¥¿¥Õ¥ì¡¼¥à dat ¤òºî¤ë > dat <- data.frame(x, y) > dat # ºî¤Ã¤¿¤Î¤Ï¡¤°Ê²¼¤Î¤è¤¦¤Ê¥Ç¡¼¥¿ x y 1 0 98 2 5 97 3 10 96 ¡§ ¡ÚÃæά¡Û 19 90 20 20 95 20 21 100 18 # y ~ a/(1+b*exp(-c*x))+d ¤¬¡¤¤¢¤Æ¤Ï¤á¤ë¤Ù¤´Ø¿ô # a, b, c, d ¤Ï¥Ñ¥é¥á¡¼¥¿¡Ê¤³¤ì¤ò¿äÄꤹ¤ë¡Ë # start= ¤Ç¡¤½é´üÃͤò»ØÄꤹ¤ë ½é´üÃͤÎÁª¤ÓÊý > nls(y ~ a/(1+b*exp(-c*x))+d, dat, start=list(a=1, b=1, c=1, d=1)) # ½é´üÃͤ¬ÉÔŬÀڤʾì¹ç¤Ë¤Ï¡¤°Ê²¼¤Î¤è¤¦¤Ê¥¨¥é¡¼¥á¥Ã¥»¡¼¥¸¤¬½Ð¤ë¤Î¤Ç¡¤½é´üÃͤòÊѤ¨¤Æ¤ß¤ë Error in nls(y ~ a/(1 + b * exp(-c * x)) + d, dat, start = list(a = 1, : singular gradient # nls ´Ø¿ô¤Î°úÍѤÀ¤±¤À¤È¡¤¥â¥Ç¥ë´Ø¿ô¡¤¿äÄꤵ¤ì¤¿¥Ñ¥é¥á¡¼¥¿ÃÍ¡¤»Äº¹Ê¿ÊýϤ¬½ÐÎϤµ¤ì¤ë > nls(y ~ a/(1+b*exp(-c*x))+d, dat, start=list(a=-80, b=47, c=0.1, d=100)) Nonlinear regression model model: y ~ a/(1 + b * exp(-c * x)) + d data: dat a b c d -81.19250400 47.73105651 0.09353186 100.00271945 residual sum-of-squares: 16.63448 # nls ´Ø¿ô¤Î·ë²Ì¤ò¥ª¥Ö¥¸¥§¥¯¥È¤ËÉÕÃÍ¡ÊÂåÆþ¡Ë¤¹¤ë¤È¡¤¸å¤Ç¡¤¤¤¤í¤¤¤í¤Ê·ë²Ì¤òÁªÂò¤·¤Æ½ÐÎϤ¹¤ë¤³¤È¤¬¤Ç¤¤ë > result <- nls(y ~ a/(1+b*exp(-c*x))+d, dat, start=list(a=-100, b=50, c=0.2, d=100)) # ¥ª¥Ö¥¸¥§¥¯¥È¤ËÂФ·¤Æ sumamry ´Ø¿ô¤òŬÍѤ¹¤ë¤È¡¤¥Ñ¥é¥á¡¼¥¿¤Î¿äÄêÃÍ¡¤É¸½à¸íº¹¡¤t ÃÍ¡¤P ÃÍ¡¤¤Î¤Û¤«¤Ë¡¤»Äº¹É¸½à¸íº¹¡¤¥Ñ¥é¥á¡¼¥¿´Ö¤ÎÁê´Ø·¸¿ô¤¬½ÐÎϤµ¤ì¤ë > summary(result) Formula: y ~ a/(1 + b * exp(-c * x)) + d Parameters: Estimate Std. Error t value Pr(>|t|) a -81.19250 1.03708 -78.290 < 2e-16 *** b 47.73111 6.52126 7.319 1.20e-06 *** c 0.09353 0.00300 31.180 < 2e-16 *** d 100.00272 0.76138 131.343 < 2e-16 *** --- Signif. codes: 0 `***' 0.001 `**' 0.01 `*' 0.05 `.' 0.1 ` ' 1 Residual standard error: 0.9892 on 17 degrees of freedom Correlation of Parameter Estimates: a b c b 0.8328 c 0.8249 0.9709 d -0.8968 -0.8118 -0.7241