[R] neuralnet to discriminate a given outcome by giving cutoff outputs
Giorgio Garziano
giorgio.garziano at ericsson.com
Sun Dec 20 20:14:34 CET 2015
I would tackle the problem in the following way:
lm.model <- lm(z~ x + y, data=m)
summary(lm.model)
Call:
lm(formula = z ~ x + y, data = m)
Residuals:
Min 1Q Median 3Q Max
-0.34476713 -0.09571506 -0.01786731 0.05225554 0.51693389
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) -0.071612058 0.041196651 -1.73830 0.0876543 .
x 0.003952998 0.001336833 2.95699 0.0045417 **
y 9.968145059 0.461213516 21.61286 < 0.000000000000000222 ***
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Residual standard error: 0.157775 on 56 degrees of freedom
Multiple R-squared: 0.905464, Adjusted R-squared: 0.9020877
F-statistic: 268.1834 on 2 and 56 DF, p-value: < 0.00000000000000022204
coef.model <- coef(lm.model)
z.hat <- coef.model[1]+coef.model[2]*x+coef.model[3]*y
z.hat.discrete <- rep(1, length(z.hat))
z.hat.discrete[z.hat <0.4] <- 0
> all.equal(z, z.hat.discrete)
[1] TRUE
I apologise for using such naif approach in place of neural net.
--
GG
http://around-r.blogspot.it
[[alternative HTML version deleted]]
More information about the R-help
mailing list