如何解决使用 Rstudio 在散点图中绘制二次回归线
我正在尝试使用以下代码在散点图中绘制二次回归线:
-
bmi
是体重指数,pbfm
是“身体脂肪含量百分比”
mod3 <- lm(pbfm ~ bmi + I(bmi^2))
par(mfrow = c(1,1))
plot(bmi,pbfm)
lines(bmi,predict(mod3),col="blue",lwd=0.02)
解决方法
为了看不到“蜘蛛网”,请在将 x 值排成一行之前对其进行排序。下面我使用 using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Reflection.Emit;
using System.Web;
using System.Web.Mvc;
using System.Web.UI.WebControls;
using Opgave.Models;
using System.Data.SqlClient;
namespace Opgave.Controllers
{
public class UserController : Controller
{
SqlConnection con = new SqlConnection();
SqlCommand com = new SqlCommand();
SqlDataReader dr;
// GET: User
[HttpGet]
public ActionResult Login()
{
return View();
}
void connectionString()
{
con.ConnectionString = "data source=LAPTOP-UMVUL6BV\SQLEXPRESS; database=SkoleNavn; integrated security=SSPI;";
}
[HttpPost]
public ActionResult Verify(UserLogin2 Acc)
{
connectionString();
con.Open();
com.Connection = con;
com.CommandText = "select * from UserLogin where Email='"+Acc.email+"' and Password='"+Acc.password+"'";
dr = com.ExecuteReader();
if (dr.Read())
{
con.Close();
return View("Index");
}
else
{
con.Close();
return View("Index");
}
}
}
}
来获取 x 值的顺序,如果 x 和 y 变量中没有 NA,应该可以工作:
order
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。