楼主: hj768
8314 11

[求助]向高手请教:nonparametric local regression techniques [推广有奖]

  • 0关注
  • 0粉丝

VIP1

已卖:110份资源

初中生

42%

还不是VIP/贵宾

-

威望
0
论坛币
1465 个
通用积分
0
学术水平
0 点
热心指数
0 点
信用等级
0 点
经验
218 点
帖子
12
精华
0
在线时间
3 小时
注册时间
2004-10-27
最后登录
2018-12-1

楼主
hj768 发表于 2006-4-21 15:11:00 |AI写论文

+2 论坛币
k人 参与回答

经管之家送您一份

应届毕业生专属福利!

求职就业群
赵安豆老师微信:zhaoandou666

经管之家联合CDA

送您一个全额奖学金名额~ !

感谢您参与论坛问题回答

经管之家送您两个论坛币!

+2 论坛币

请问如何在Matlab里实现lowess (locally weighted scatterplot smoothing) regression.

是否有软件直接可以实现呢?

多谢!

二维码

扫码加我 拉你入群

请注明:姓名-公司-职位

以便审核进群资格,未注明则拒绝

关键词:Techniques regression Parametric regressio Technique 高手 regression Techniques Local

回帖推荐

hanszhu 发表于5楼  查看完整内容

For SPSS, Somebody said: The locally weighted regression and scatterplot smoothing (LOWESS) technique was applied to allow the graphed data to reveal their own patterns; LOWESS is available as part of the SPSS software [此贴子已经被作者于2006-4-22 1:24:56编辑过]

hanszhu 发表于4楼  查看完整内容

For Matlab: mslowessSmooth mass spectrum using nonparametric method Syntax Yout = mslowess(MZ, Y, 'PropertyName', PropertyValue...)mslowess(..., 'Order', OrderValue)mslowess(..., 'Span', SpanValue)mslowess(..., 'Kernel', KernelValue)mslowess(..., 'RobustIterations', RobustIterationsValue)mslowess(..., 'ShowPlot', ShowPlotValue) ArgumentsMZMass/charge vector with the range of ions in the spectra ...

hanszhu 发表于3楼  查看完整内容

Continued: Parameters DATA=_LAST_ Name of the input data set. X = X Name of the independent (X) variable. Y = Y Name of the dependent (Y) variable to be smoothed. ID= Name of an optional character variable to identify observations. OUT=SMOOTH Name of the output data set. The output data set contains the X=, Y=, and ID= variables plus the variables _YHAT_, _RESID_, and _WEIG ...

hanszhu 发表于3楼  查看完整内容

For SAS: SAS Macro Programs for Statistical Graphics: LOWESS LOWESS macro ( get lowess.sas) The LOWESS macro performs robust, locally weighted scatterplot smoothing as described in "Section 4.4.2". The data and the smoothed curve are plotted if PLOT=YES is specified. The smoothed response variable, residuals, and observation weights are returned in the output data set named by the OUT= parame ...

本帖被以下文库推荐

沙发
hanszhu 发表于 2006-4-22 01:01:00

For SAS:

SAS Macro Programs for Statistical Graphics: LOWESS

LOWESS macro ( get lowess.sas)

The LOWESS macro performs robust, locally weighted scatterplot smoothing as described in "Section 4.4.2". The data and the smoothed curve are plotted if PLOT=YES is specified. The smoothed response variable, residuals, and observation weights are returned in the output data set named by the OUT= parameter. An optional output ANNOTATE= data set can also be produced, which may be used to apply the lowess smoothing in a more complex plotting application.

As of Version 2.1, the LOWESS macro will use PROC LOESS if running under Version 7 of the SAS System. This makes the macro much faster, particularly for large data sets. For use with SAS 6.12 or earlier, use the STEP= parameter to control the number of data points at which the local regressions are computed.

[此贴子已经被作者于2006-4-22 1:24:03编辑过]

已有 1 人评分经验 论坛币 收起 理由
胖胖小龟宝 + 30 + 30 热心帮助其他会员

总评分: 经验 + 30  论坛币 + 30   查看全部评分

藤椅
hanszhu 发表于 2006-4-22 01:01:00

Continued:

Parameters

DATA=_LAST_
Name of the input data set.
X = X
Name of the independent (X) variable.
Y = Y
Name of the dependent (Y) variable to be smoothed.
ID=
Name of an optional character variable to identify observations.
OUT=SMOOTH
Name of the output data set. The output data set contains the X=, Y=, and ID= variables plus the variables _YHAT_, _RESID_, and _WEIGHT_. _YHAT_ is the smoothed value of the Y= variable, _RESID_ is the residual, and _WEIGHT_ is the combined weight for that observation in the final iteration.
F = .50
Lowess window width, the fraction of the observtions used in each locally-weighted regression. A larger window width makes the curve smoother, but may lead to lack of fit. Values of F > 1 are allowed.
P = 1
Degree of the locally-weighted regressions. P=1 gives linear fits, appropriate when the data do not have several peaks and valleys; P=2 gives quadratic fits, which are useful when they do.
ITER=2
Total number of iterations.
ROBUST=1
Specifies whether to perform robustness re-weightings, which decrease the weights for observations with large residuals in the next iteration. Set ROBUST=0 to suppress the robust calculations. For binary dependent variables, the robustness step is usually not performed.
CLM=
[Version 7+ only] Specifies the significance level for confidence intervals about the smoothed curve. Use CLM=0.05 for 95% confidence intervals.
STEP=1
Step for successive X values. By default, the macro performs the locally-weighted regression at each X, which can be computationally intensive for moderately large data sets. Setting STEP > 1 causes the macro to perform the regression at every STEP-th value of the index i, and to use predicted values from that regression for intermediate points. It is recommended to specify a STEP value at least n/100 for moderate to large sized datasets.
PLOT=NO
Specifying PLOT=YES, draws both a printer plot and a high-resolution plot. You may wish to change the default values of the PLOT, GPLOT or PPLOT options to suit your taste.
GPLOT=NO
Draw the plot? If you specify PLOT=YES, a high-resolution plot is drawn by the macro.
PPLOT=NO
Draw a printer plot? If you specify PPLOT=YES, a printer plot is drawn by the macro.
SYMBOL=CIRCLE
Plotting symbol used for points
HTEXT=1.5
Height for axis labels and values
HSYM=1.5
Height for point symbols
COLORS=BLACK RED
colors for points and smooth curve
LINE=1
Line style for the smooth curve
HAXIS=
The name of an AXIS statements for the horizontal axis
VAXIS=
The name of an AXIS statements for the vertical axis
OUTANNO=
Name of output ANNOTATE= dataset which draws the smoothed lowess curve. This dataset is produced only if the OUTANNO= name is specified.
IN=
Name of an optional input ANNOTATE= data set, which is concatenated to the OUTANNO= data set.
NAME=LOWESS
The name assigned to the graph in the graphic catalog.

Missing data

Any observations with missing data on the X or Y variables are removed before finding the lowess fit.

Usage Note

Under some older versions of the SAS System, it may be neccessary to add the option WORKSIZE=100 to the PROC IML statement.

Example

This example plots gas mileage (MPG) vs weight, with a smoothed lowess curve showing a (slight) nonlinear dependence of mileage on weight. The plot is drawn by the macro from the OUT=SMOOTH data set. An output ANNOTATE= data set is also produced.
title 'Auto data with lowess smoothing';
%include data(auto);
%include macros(lowess);

%lowess(data=auto,out=smooth, x=weight, y=mpg,
id=model, htext=2,
f=.4, plot=YES,
colors=blue red, outanno=lowess);

[此贴子已经被作者于2006-4-22 1:11:31编辑过]

已有 1 人评分经验 论坛币 学术水平 热心指数 信用等级 收起 理由
Sunknownay + 100 + 10 + 1 + 1 + 1 热心帮助其他会员

总评分: 经验 + 100  论坛币 + 10  学术水平 + 1  热心指数 + 1  信用等级 + 1   查看全部评分

板凳
hanszhu 发表于 2006-4-22 01:06:00

For Matlab:

mslowess
Smooth mass spectrum using nonparametric method

Syntax
Yout = mslowess(MZ, Y, 'PropertyName', PropertyValue...)
mslowess(..., 'Order', OrderValue)
mslowess(..., 'Span', SpanValue)
mslowess(..., 'Kernel', KernelValue)
mslowess(..., 'RobustIterations', RobustIterationsValue)
mslowess(..., 'ShowPlot', ShowPlotValue)


Arguments
MZ
Mass/charge vector with the range of ions in the spectra.

Y
Ion intensity vector with the same length as the mass/charge vector (MZ). Y can also be a matrix with several spectra that share the same mass/charge (MZ) range.


Description
Yout = mslowess(MZ, Y, 'PropertyName', PropertyValue...) smoothes a mass spectrum (Y) using a locally weighted linear regression (lowess) method with a default span of 10 samples.

Note 1) mslowess assumes that a mass/charge vector (MZ) might not be uniformly spaced. Therefore, the sliding window for smoothing is centered using the closest samples in terms of the MZ value and not in terms of the MZ indices.

2) When the vector MZ does not have repeated values or NaNs, the algorithm is approximately twice as fast.


mslowess(..., 'Order', OrderValue) specifies the order (OrderValue) of the Lowess smoother. Enter 1 (linear polynomial fit or Lowess), 2 (quadratic polynomial fit or Loess), or 0 (equivalent to a weighted local mean estimator and presumably faster because only a mean computation is performed instead of a least squares regression). The default value is 1.

Note The MATLAB Curve Fitting Toolbox also refers to Lowess smoothing of order 2 as Loess smoothing.

mslowess(..., 'Span', SpanValue) specifies the window size for the smoothing kernel. If SpanValue is greater than 1, the window is equal to SpanValue number of samples independent of the mass/charge vector (MZ). The default value is 10 samples. Higher values will smooth the signal more at the expense of computation time. If SpanValue is less than 1, the window size is taken to be a fraction of the number of points in the data. For example, when SpanValue is 0.005, the window size is equal to 0.50% of the number of points in MZ.

mslowess(..., 'Kernel', KernelValue) selects the function (KernelValue) for weighting the observed ion intensities. Samples close to the MZ location being smoothed have the most weight in determining the estimate. Enter

'tricubic' (default) (1 - (dist/dmax).^3).^3
'gaussian' exp(-(2*dist/dmax).^2)
'linear' 1-dist/dmaxmslowess(..., 'RobustIterations', RobustIterationsValue) specifies the number of iterations (RobustValue) for a robust fit. If RobustIterationsValue is 0 (default), no robust fit is performed. For robust smoothing, small residual values at every span are outweighed to improve the new estimate. 1 or 2 robust iterations are usually adequate while, larger values might be computationally expensive.

Note For a uniformly spaced MZ vector, a nonrobust smoothing with Order equal to 0 is equivalent to filtering the signal with the kernel vector.


mslowess(..., 'ShowPlot', ShowPlotValue)plots the smoothed spectrum over the original spectrum. When mslowess is called without output arguments, the spectra are plotted unless ShowPlotValue is false. When ShowPlotValue is true, only the first spectrum in Y is plotted. ShowPlotValue can also contain an index to one of the spectra in Y.

Example
Load sample data.

load sample_lo_resSmooth spectrum and draw figure with unsmoothed and smoothed spectra.

YS = mslowess(MZ_lo_res,Y_lo_res(:,1),'Showplot',true);

[此贴子已经被作者于2006-4-22 1:25:49编辑过]

报纸
hanszhu 发表于 2006-4-22 01:12:00

For SPSS,

Somebody said: The locally weighted regression and scatterplot smoothing (LOWESS) technique was applied to allow the graphed data to reveal their own patterns; LOWESS is available as part of the SPSS software

[此贴子已经被作者于2006-4-22 1:24:56编辑过]

地板
hanszhu 发表于 2006-4-22 01:22:00

Applied Regression Analysis by John Fox:

SPSS will not allow the multiple regression lines to be placed on a single graph. Also, we do not know how to do a lowess non-parametric regression in SPSS.

[此贴子已经被作者于2006-4-22 1:23:00编辑过]

7
hanszhu 发表于 2006-4-22 01:32:00
SPSS FAQ: How can I do a scatterplot with regression line in SPSS?

[此贴子已经被作者于2006-4-22 1:32:28编辑过]

8
jackney2008 发表于 2007-5-24 10:53:00

哇,高手。厉害,向你学习

9
蓝色 发表于 2007-5-24 11:14:00

stata里面简单

lowess y x

下面是stata中的帮助


-------------------------------------------------------------------------------------------------------
help for lowess manual: [R] lowess
dialog: lowess
-------------------------------------------------------------------------------------------------------

Lowess smoothing

lowess yvar xvar [if exp] [in range] [, mean noweight bwidth(#) logit adjust generate(newvar)
nograph plot(plot) rlopts(cline_options) scatter_options twoway_options ]


Description

lowess carries out a locally weighted regression of yvar on xvar, displays the graph, and
optionally saves the smoothed variable.

Warning: lowess is computationally intensive and may therefore take a long time to run on a slow
computer. Lowess calculations on 1,000 observations, for instance, require estimating 1,000
regressions.


Options

mean specifies running-mean smoothing; the default is running-line least-squares smoothing.

noweight prevents the use of Cleveland's (1979) tricube weighting function; the default is to use
the weighting function.

bwidth(#) specifies the bandwidth. Centered subsets of bwidth()*N observations are used for
calculating smoothed values for each point in the data except for end points, where smaller,
uncentered subsets are used. The greater the bwidth(), the greater the smoothing. The
default is 0.8.

logit transforms the smoothed yvar into logits.

adjust adjusts (by multiplication) the mean of the smoothed yvar to equal the mean of yvar. This
is useful when smoothing binary (0/1) data.

generate(newvar) creates newvar containing the smoothed values of yvar in addition to or instead
of displaying the graph.

nograph suppresses displaying the graph.

plot(plot) provides a way to add other plots to the generated graph; see help plot_option.

rlopts(cline_options) affect the rendition of the reference line; see help cline_options.

scatter_options affect the rendition of the plotted points; see help scatter.

twoway_options are any of the options documented in help twoway_options. These include options
for titling the graph (see help title_options), options for saving the graph to disk (see
help saving_option), and the by() option (see help by_option).


Examples

. lowess h1 depth
. lowess h1 depth, bwidth(.4)

. lowess foreign mpg, ylabels(0 "Domestic" 1 "Foreign") jitter(5) adjust
. lowess foreign mpg, logit yline(0)


Also see

Manual: [R] lowess

Online: help for graph, ipolate, smooth

10
楚韵荆风 学生认证  发表于 2009-12-27 12:34:33
在R里面直接用lowess(data)命令就可以
共享是一种彼此的快乐

您需要登录后才可以回帖 登录 | 我要注册

本版微信群
加好友,备注jltj
拉您入交流群
GMT+8, 2025-12-24 17:41