Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8696967
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T01:23:56+00:00 2026-06-13T01:23:56+00:00

> reg.len <- lm(chao1.ave ~ lg.std.len, b.div) # b.div is my data frame imported

  • 0
> reg.len <- lm(chao1.ave ~ lg.std.len, b.div) # b.div is my data frame imported from a CSV file
> reg.len

Call:
lm(formula = chao1.ave ~ lg.std.len, data = b.div)

Coefficients:
(Intercept)   lg.std.len  
      282.4       -115.7  

> newx <- seq(0.6, 1.4, 0.01)
> prd.len <- predict(reg.len, newdata=data.frame(x=newx), interval="confidence", level=0.90, type="response")
Error in eval(expr, envir, enclos) : object 'lg.std.len' not found

I’ve tried doing the lm like this: lm(b.div$chao1.ave ~ b.div$lg.std.len), but then, predict() gives a warnings that the newdata and variables are different lengths. So, I tried the way above, and now predict() gives an error saying it doesn’t recognize the object. How to fix, please?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T01:23:58+00:00Added an answer on June 13, 2026 at 1:23 am

    Predict expects newdata to have the same column names (to match the formula in reg.len). You’re changing it to “x” in your newdata specification, which isn’t part of the formula.

    dat <- data.frame(y=rnorm(50),lg.std.len=sample(10:15,50,replace=TRUE))
    reg.len <- lm(y ~ lg.std.len,data=dat)
    
    newx <- seq(0.6, 1.4, 0.01)
    prd.len <- predict(reg.len, newdata=data.frame(lg.std.len=newx),
                       interval="confidence", level=0.90, type="response")
    

    The key part is newdata=data.frame(lg.std.len=newx)

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

i am generating *.reg file using code which will have some important data. and
I'm use reg->SaveKey(Software, D:\1.reg). But getting empty file, without data. void __fastcall TForm1::Button2Click(TObject *Sender)
Reg ex again. Trying to run a like SQL query: mysql_query(SELECT * From tablename
If I call REG QUERY HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Authentication\LogonUI in a batch script then the correct result
I have created necessary .reg file for the toolbar button as per the link
SELECT nar.name, nar.reg, stat.lvl FROM members AS nar JOIN stats AS stat ON stat.id
I can't get REG_DWORD data from USBSTOR registry key, but I can get 'DisplayName'
C# winforms - How can I import a reg file into the registry? The
I need to install a .reg file (INTRANET) by using Java. How do i
the file .reg generate when finish the pear installation was addedd and when i

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.