[R] lm - log(variable) - skip log(0)
David Winsemius
dwinsemius at comcast.net
Fri Feb 25 16:37:00 CET 2011
On Feb 25, 2011, at 7:25 AM, agent dunham wrote:
>
> Apologies, I'm really new with R, Can you help me with the syntax?
>
> here is my data.frame in which I introduce independent variables:
>
>> varind <-
>> data.frame(datpos$hdom2,datpos$NumPies,datpos$InHart,datpos
>> $CV,datpos$CA,datpos$FCC)
>
> varind has dimensions(194, 6), in case that's necessary. Then I type:
>
>> loglmp4 <- lm(log(datpos$IncAltuDom)~log(varind), subset=varind>0)
Because varind is now a dataframe, you need to refer to its columns
when offering candidate independent variables to lm. It is not clear
which column you wanted to test for positivity and which use on the
RHS from varind. You should also get in the habit of:
--- including context in followup questions
--- using the data= argument in model construction
Going back to your original question where the dataframe was named
"dat"and it was clear what variable you wanted on the RHS:
lmod1.lm <- lm( log(inaltu)~log(indiam), data= dat, subset=(indiam > 0
& inaltu > 0) )
--
David.
>
> Error en model.frame.default(formula = log(datpos$IncAltuDom) ~
> log(varind),
> :
> invalid type (list) for variable 'log(varind)'
>
> Thanks again,user at host.com
> --
> View this message in context: http://r.789695.n4.nabble.com/lm-log-variable-skip-log-0-tp3324263p3324344.html
> Sent from the R help mailing list archive at Nabble.com.
>
> ______________________________________________
> 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.
David Winsemius, MD
West Hartford, CT
More information about the R-help
mailing list