[R] about lm()

(Ted Harding) Ted.Harding at wlandres.net
Sun Mar 30 23:12:20 CEST 2014


I suspect the problem may be with the structure of the data.

Si Qi L wrote:
  [...]
  acc1<- lm(data$acc ~ dummy + data$Reqloanamount + data$Code +
  data$Code.1 + data$EmpNetMonthlyPay + data$Customer_Age + data$RTI)
  [...]
  These attributes are all numerical except the "acc"(factors)
  [...]

If, as he implies, the "acc" variable in "data" is a factor,
then lm() will not enjoy fitting an lm where the dependent
variables (response) is a factor!

Just a shot in the dark ...
Ted.

On 30-Mar-2014 18:46:27 Bert Gunter wrote:
> 1. Post in plain text, not HTML.
> 
> 2. Read ?lm and note the data argument. Use it in your lm call instead
> of all the xxxx$data extractions.
> 
> 3. Your problem is with the summary() call, so read ?summary.lm. Learn
> about S3 methods if you do not know where the ".lm" part is coming
> from by reading the "Introduction to R " tutorial that ships with R,
> which you should have read already anyway.
> 
> Cheers,
> Bert
> 
> Bert Gunter
> Genentech Nonclinical Biostatistics
> (650) 467-7374
> 
> "Data is not information. Information is not knowledge. And knowledge
> is certainly not wisdom."
> H. Gilbert Welch
> 
> 
> 
> 
> On Sun, Mar 30, 2014 at 9:43 AM, Frank Schwidom <schwidom at gmx.net> wrote:
>> Please provide some data from your variable data.
>>
>> Show the output of dput( data) or an subset
>> of data which leads toe the specific error.
>>
>> Regards
>>
>>
>> On Sun, Mar 30, 2014 at 02:23:09PM +0100, Si Qi L. wrote:
>>> Hi
>>>
>>> I have a problem with linear regression. This is my codes:
>>>
>>> acc1<- lm(data$acc ~ dummy + data$Reqloanamount + data$Code + data$Code.1 +
>>> data$EmpNetMonthlyPay + data$Customer_Age + data$RTI)
>>> summary(acc1)
>>>
>>> These attributes are all numerical except the "acc"(factors), so how can I
>>> fix the problem R showed me? can anyone please help me out? Many thanks!
>>>
>>> But the R shows:
>>>
>>> Residuals:Error in quantile.default(resid) : factors are not allowedIn
>>> addition: Warning message:In Ops.factor(r, 2) : ^ not meaningful for
>>> factors
>>>
>>>       [[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.
>>
>> ______________________________________________
>> 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.
> 
> ______________________________________________
> 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.

-------------------------------------------------
E-Mail: (Ted Harding) <Ted.Harding at wlandres.net>
Date: 30-Mar-2014  Time: 21:12:16
This message was sent by XFMail




More information about the R-help mailing list