Hi...it\'s a same question.. i think i said wrong By below summary code, i got t
ID: 3331166 • Letter: H
Question
Hi...it's a same question.. i think i said wrong
By below summary code, i got the fitted model.
please let me know the R-code!!! please help me
################3
rm(list = ls())
x <- seq(1,10,by=0.09)
true <- exp(0.1+0.02*x^2)
y <- true
fit <- lm(y~poly(x,6))
summary(fit)
> summary(fit)$coefficients Estimate std. Errort value Pr(>ltI) (Intercept) 2.79857679 8.012514e-05 34927. 57298 0.000000e+00 poly(x, 6)1 16.77159655 8.052477e-04 20827.87204 4.995802e-315 poly(x, 6)2 7.62943262 8.052477e-04 9474.64041 7.150096e-283 poly(x, 6)3 2.44538467 8.052477e-04 3036.81041 2.012623e-236 poly(x, 6)4 0.69878305 8.052477e-04 867.78644 2.740945e-185 poly(x, 6)5 0.16999634 8.052477e-04 211.11061 1.272699e-127 poly(x, 6)6 0.03796942 8.052477e-04 47.15247 3.201698e-67Explanation / Answer
This code should work
six_order <- function(newdist, model) {
coefs <- coef(model)
#y =g + fx+ ex^2 + dx^3 + cx^4 + bx^5 + ax^6
res <- coefs[1] + (coefs[2] * newdist) + (coefs[3] * newdist^2) + (coefs[4] * newdist^3) +(coefs[5] * newdist^4)
+(coefs[6] * newdist^5) +(coefs[7] * newdist^6)
return(res)
}
run above script and run below code to get value of f(5)
six_order(5,fit )
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.