[R] predict lm doubt

Henrique Dallazuanna wwwhsd at gmail.com
Fri Mar 18 13:53:51 CET 2011


Your lm args are wrong:

Try this:

predict(lm(Dens_min ~ Velocity, dfTestes3sitesCriptic))

or

predict(lm(Dens_min ~ Velocity_corrected, dfTestes3sitesCriptic))


On Fri, Mar 18, 2011 at 9:45 AM, barbara costa <rbarbarahc at gmail.com> wrote:
> Hello,
>  does anyone knows this predict is not resulting?
>
> # lm predict
> dfTestes3sitesCriptic$Velocity_corrected <- ifelse
> (dfTestes3sitesCriptic$Season == "A" & dfTestes3sitesCriptic$BeforeAfter ==
> "Before", (dfTestes3sitesCriptic$Velocity * mVel3ABefAfter), (ifelse
> (dfTestes3sitesCriptic$Season == "Sp" & dfTestes3sitesCriptic$BeforeAfter ==
> "Before", (dfTestes3sitesCriptic$Velocity  * mVel3SpBefAfter),
> dfTestes3sitesCriptic$Velocity )))
>
> dfTestes3sitesCriptic$Dens_min_corrected <- predict (lm(
> dfTestes3sitesCriptic$Dens_min ~ dfTestes3sitesCriptic$Velocity,
> dfTestes3sitesCriptic$Velocity_corrected))
>
>
> just for help:
> Code_Site Year Season YearSeason Type_Environment BeforeAfter Species_Group
> 31    PPBNoc 1998      A     1998-A    Criptobenthic      Before
> Fish
> 33    PPBNoc 1999     Sp    1999-Sp    Criptobenthic      Before
> Fish
> 35    PPBNoc 2009      A     2009-A    Criptobenthic       After
> Fish
> 37    PPBNoc 2009     Sp    2009-Sp    Criptobenthic       After
> Fish
> 39    PPBNoc 2010      A     2010-A    Criptobenthic       After
> Fish
>   TransectTime_min TransectLenght_m Area_m2 Number Density Velocity
> Dens_min
> 31            15.00               55      55     89    1.62     3.67
> 5.93
> 33            15.00               55      55     50    0.91     3.67
> 3.33
> 35            18.15               45      45    185    4.11     2.48
> 10.20
> 37            10.23               45      45     92    2.04     4.40
> 9.00
> 39            16.92               45      45    251    5.58     2.66
> 14.84
>   Code_Site2 Velocity_corrected
> 31       TRUE               2.58
> 33       TRUE               3.25
> 35       TRUE               2.48
> 37       TRUE               4.40
> 39       TRUE               2.66
>
>
>
> Thanks a lot.
> Barbara
>
>        [[alternative HTML version deleted]]
>
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>



-- 
Henrique Dallazuanna
Curitiba-Paraná-Brasil
25° 25' 40" S 49° 16' 22" O



More information about the R-help mailing list