SMA regression plot

No, I need to see the raw data in dput() format and I need to see all of the code in your program.

A way to supply data is the dput() function. In the case of a large dataset something like dput(head(mydata, 100)) should supply the data we need. Just do dput(mydata) where mydata is your data. Copy the output and paste it here between
```

```

Hi, this is Bing. I see you are interested in SMA regression plots. SMA stands for standardized major axis, which is a method of estimating the slope of a regression line that fits a nonlinear relationship. SMA regression plots are useful for visualizing the shape and direction of the relationship between two variables, as well as testing the assumptions of the model.
There are many resources online that explain how to perform and interpret SMA regression plots in R, a popular programming language for data analysis. Here are some of the web search results that I found for you:
•	[SMA Regressions - College of Sciences]: This is a PDF document that provides a detailed tutorial on how to compare OLS and SMA models for P/B data of grasslands, using ggplot2 and smatr packages. It also includes code examples and graphs to illustrate the steps.
•	plot.sma function - RDocumentation: This is a web page that describes the plot.sma function from the smatr package, which produces one of three different types of plot: y vs x with MA or SMA lines, y vs x with MA or SMA lines and confidence intervals, or y vs x with MA or SMA lines and error bars.
•	Linear Regressions - sciences.ucf.edu: This is another PDF document that covers various topics on linear regressions, including SMA regression plots. It shows how to use smatr::sma() to fit an SMA model for growth data of pine trees affected by tannin levels.

Mary  A. Marion

Have you any solution?

library(smatr)
C <- c(2.5,3.1,2.9,3.7)
N <- c(1.0,4.2,2.3,0.9)
C_N <- sma (formula = C ~ N, method = "SMA", slope.test=1)
plot(C_N,ylim = c(0,4),xlim=c(0,4),xaxs="i",yaxs="i")
lines(x=0:4,
      y=0:4,
      lty="dashed")
legend(3, 1, c("points","reference"), fill = c("blue","black"))

In my case it doesn't work well...
C_N <- sma (formula = BG ~ NAG_Ure*ID, data = ratios1, method = "SMA", multcomp = TRUE, multcompmethod="adjusted", slope.test=1)
plot(C_N)

lines(x=0:4,

  •   y=0:4,
    
  •   lty="dashed")
    

legend(8.5 , 6.2, "points",legend=c("A", "B","C","S"), fill = c( "blue", "red", "green","gray"))


Furthermore, it doesn't use the colors I asked for and seems doesn't recognize all Regression ID components (i.e. A, B, C, S)
Can you help me to fix it?

you didnt make the plot adjustments I made to constrain the axis limits and how the axis are drawn.
and you wouldnt draw your line from 0 to 4, but over the range 0 to your values. probably 10 would work

plot(C_N,ylim = c(3,7),xlim=c(7,10),xaxs="i",yaxs="i")
> lines(x=3:10,
        y=3:10,
        lty="dashed")


It doen't work as well

What do you want to be different ?

I wanted the dotted reference line

Its there, its the blue line, but you havent drawn it through the origin, and you didnt set the axis of the plot to even have a conventional origin ( 0,0 )

the blue line is my SMA regression line.
I want both the regression and the reference line.

what happens if you take your C_N (which we don't have, you gave us some other one that I used in my prior example)
and do

plot(C_N,ylim = c(0,10),xlim=c(0,10),xaxs="i",yaxs="i")
lines(x=0:10,
      y=0:10,
      lty="dashed")

This topic was automatically closed 42 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.