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

  • SEARCH
  • Home
  • 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 7905015
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T10:17:54+00:00 2026-06-03T10:17:54+00:00

I am trying to estimate parameters for generalized least-squares regression on some community data.

  • 0

I am trying to estimate parameters for generalized least-squares regression on some community data. I have successfully done this for one set of data, but when I try the same technique to estimate parameters for another group, I get the following error message:

Error in gnls(SF ~ a * Site_Code^b, data = data, weights = varPower(form = ~Site_Code),  : 
  Step halving factor reduced below minimum in NLS step

I have noticed that other people have the same issue. One proposed solution is to set nlsTol to 0.1 instead of 0.001 (the default) using gnlsControl, but when I do this, I have the same issue. My data looks like this:

Site_Code   SF
5   3
5   0
5   2
5   0
5   0
5   0
5   2
5   0
5   0
5   0
5   0
5   3
1   0
1   1
1   29
1   15
1   7
1   0
1   10
1   12
1   55
2   0
2   5
2   0
2   0
2   3
2   24
2   49
2   17
2   1
3   4
3   48
3   7
3   1
3   31
3   0
3   0
3   1
4   8
4   16
4   29
4   0
4   1
4   2
4   1
4   7
4   3
7   2
7   0
7   0
7   0
7   0
7   0
7   2
7   1
7   0
7   1
7   0
7   0
8   1
8   2
8   1
8   2
8   0
8   0
8   3
8   0
8   2
6   0
6   6
6   0
6   0
6   0
6   0
6   0
6   0
6   0
6   2
6   0
6   3
  • 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-03T10:17:55+00:00Added an answer on June 3, 2026 at 10:17 am

    Worked fine for me; you didn’t give starting values, so I eyeballed some. Maybe you have worse starting values?

    Also, it’s not surprising that you’re having trouble here — for the purposes of fitting the mean, you have two parameters and only 4 independent x values … and the same for the variance estimation.

    dat <- read.table("gnlsdat.txt",header=TRUE)
    plot(SF~Site_Code,data=x)
    
    library(nlme)
    g0 <- gnls(SF ~ a * Site_Code^b, data = dat,
               weights = varPower(form = ~Site_Code),
               start=list(a=30,b=-0.5))
    

    Results:

    Generalized nonlinear least squares fit
      Model: SF ~ a * Site_Code^b 
      Data: dat 
      Log-likelihood: -130.3289
    
    Coefficients:
            a         b 
    19.319493 -1.152149 
    
    Variance function:
     Structure: Power of variance covariate
     Formula: ~Site_Code 
     Parameter estimates:
        power 
    -0.885528 
    Degrees of freedom: 33 total; 31 residual
    Residual standard error: 28.10023 
    

    Plot:

    plot(SF~Site_Code,data=x)
    pframe <- data.frame(Site_Code=seq(1,5,length=41))
    lines(pframe$Site_Code,predict(g0,newdata=pframe))
    

    enter image description here

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

Sidebar

Related Questions

I am trying to analyze some probability data with R. The data I have
Trying to do a simple insert, and this one line is giving me issues.
I am trying to estimate the shape and scale of a data set. I
I'm trying to do an estimate for a data integration, and the client sent
I am trying to create a php estimate form for my business. I have
I've been trying to estimate the size of an Access table with a certain
Trying to convert a perl script to php. In perl I have a hash
Trying to merge 8 pre-sorted arrays. I'm fairly new to C, but this is
While trying to estimate the amount of memory consumed by a kernel module (usually
I am trying to send an email message with data collected from an html

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.